Majority of host drivers using IDE PCI layer set drive->autotune, the only
exceptions are:
generic.c
ns87415.c
rz1000.c
trm290.c
* no ->set_pio_mode method
it821x.c:
* if memory allocation fails drive->autotune won't be set
(but there also won't be ->set_pio_mode method in such case)
piix.c:
* MPIIX controller (no ->init_hwif method so also no ->set_pio_mode method)
However if there is no ->set_pio_mode method there are no changes in behavior
w.r.t. PIO tuning so always set drive->autotune in ide_pci_setup_ports().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Since cs5520 uses VDMA best PIO mode was tuned anyway by ide_dma_check()
but only if DMA was successfully initialized.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add IDE_HFLAG_LEGACY_IRQS host flag to tell ide_pci_setup_ports() to set
hwif->irq to legacy IRQ 14/15 (iff hwif->irq is not already set) and convert
atiixp, piix, serverworks, sis5513 and slc90e66 host drivers to use it.
While at it:
* In piix.c add IDE_HFLAGS_PIIX define and don't use ->init_hwif for MPIIX.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add IDE_HFLAG_SERIALIZE host flag to tell ide_pci_setup_ports() to set
hwif/mate->serialized and convert aec62xx, cs5530 and sc1200 host drivers
to use it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add IDE_HFLAG_ERROR_STOPS_FIFO host flag and use it instead
of hwif->err_stops_fifo. As a side-effect this change fixes
hwif->err_stops_fifo not being restored by ide_hwif_restore().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add DECLARE_ICH_DEV() macro.
While at it:
* Add init_hwif_ich() (->init_hwif method) for ICH controllers.
* Rename init_chipset_piix() to init_chipset_ich() and use it only for
ICH controllers.
* Remove no longer needed piix_is_ichx() helper.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* No need to disable UDMA in ->init_hwif method for ATP850UF (and since we
now always tune PIO it will be disabled by ->set_pio_mode calls anyway).
* Bump driver version.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Merge init_setup_{svwks,csb6}() into svwks_init_one().
While at it:
* Remove redundant dev->device checks.
* Operate on a local copy of serverworks_chipsets[] entry.
* Use pci_resource_start().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Split off pdc20270_get_dev2() helper from init_setup_pdc20270().
* Merge init_setup_{pdcnew,pdc20270,pdc20276}() into pdc202new_init_one().
While at it:
* Change KERN_ level of interrupt fixup message from KERN_WARNING to KERN_INFO.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Split off hpt{374,371,366}_init() helper from init_setup_hpt{374,371,366}().
* Merge init_setup_{374,372n,371,372a,302,366}() into hpt366_init_one().
While at it:
* Use "HPT36x" name for HPT366/HPT368 chipsets.
* Add .chip_name to struct hpt_info and use it to set set d->name.
* Convert .max_ultra in struct hpt_info to .udma_mask and use it to set
d->udma_mask.
* Fix hpt302 to use HPT302_ALLOW_ATA133_6 define.
* Change HPT366/HPT374 interrupt fixup message from KERN_WARNING to KERN_INFO.
* Use the second hpt366_chipsets[] entry for HPT37x chipsets using HPT36x PCI
device ID and fix .enablebits/.host_flags for HPT36x hpt366_chipsets[] entry.
* Bump driver version.
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Merge init_setup_{aec62xx,aec6x80}() into aec62xx_init_one().
While at it:
* Use id->driver_data instead of dev->device.
* Use ATA_UDMA6 define.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Some places were using PCI_CLASS_REVISION instead of PCI_REVISION_ID so
they were not converted by commit 44c10138fd.
Cc: Auke Kok <auke-jan.h.kok@intel.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add ->mwdma_mask and ->swdma_mask to ide_pci_device_t.
* Set ide_hwif_t DMA masks using DMA masks from ide_pci_device_t in
setup-pci.c::ide_pci_setup_ports() (iff DMA base is valid and ->init_hwif
method may still override them).
* Convert IDE PCI host drivers to use ide_pci_device_t DMA masks.
While at it:
* Use ATA_{UDMA,MWDMA,SWDMA}* defines.
* hpt34x.c: add separate ide_pci_device_t instances for HPT343 and HPT345.
* serverworks.c: fix DMA masks being set before checking DMA base.
v2:
* Add missing masks to DECLARE_GENERIC_PCI_DEV() macro.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Documentation doesn't mention SWDMA and moreover all timings used
for SWDMA modes were over-clocked when compared to ATA spec.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add IDE_HFLAG_NO_LBA48[_DMA] host flags, use it instead of hwif->no_lba48[_dma]
and then remove no longer needed hwif->no_lba48[_dma]. As a side-effect
this change fixes hwif->no_lba48_dma not being restored by ide_hwif_restore().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Make ide_pci_device_t.host_flags u32 and add IDE_HFLAG_CS5520 host flag.
* Pass ide_pci_device_t *d to setup-pci.c::ide_get_or_set_dma_base()
and use d->name instead of hwif->cds->name.
* Set IDE_HFLAG_CS5520 host flag in cs5520 host driver and use it in
ide_get_or_set_dma_base() to find out which PCI BAR to use, remove no longer
needed cs5520.c::cs5520_init_setup_dma() and ide_pci_device_t.init_setup_dma.
This fixes PCI bus-mastering not being checked for CS5510/CS5520 hosts.
v2:
* It is wrong to check simplex bits on CS5510/CS5520 as v1 did.
(Noticed by Alan).
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add IDE_HFLAG_NO_{DMA,AUTODMA} host flags. Convert all host drivers using
ide_pci_device_t to use these flags instead of d->autodma and then remove no
longer needed d->autodma.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add IDE_HFLAG_BOOTABLE host flag and IDE_HFLAG_OFF_BOARD define. Convert
all host drivers using ide_pci_device_t to use IDE_HFLAG_{BOOTABLE,OFF_BOARD}
instead of d->bootable and then remove no longer needed d->bootable.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add IDE_HFLAG_NO_ATAPI_DMA host flag and set it in host drivers which
don't support ATAPI DMA. Then remove no longer needed hwif->atapi_dma.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add DECLARE_GENERIC_PCI_DEV() macro to generic IDE PCI host driver
and use it to cleanup generic_chipsets[].
* Remove dead/obsolete code while at it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
The cs5535 uses an incorrect construct to access the other drive of a pair,
causing it to access beyond an array boundary on the secondary interface.
This fixes it by using the new ide_get_paired_drive() helper instead.
Bart: patch description fixes
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andrew Morton <akpm@osdl.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
The siimage uses an incorrect construct to access the other drive of a pair,
causing it to access beyond an array boundary on the secondary interface.
This fixes it by using the new ide_get_paired_drive() helper instead.
Bart: patch description fixes
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andrew Morton <akpm@osdl.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This belongs to user-space (and only if really needed).
text data bss dec hex filename
6723 2000 28 8751 222f drivers/ide/pci/amd74xx.o.before
3833 2000 16 5849 16d9 drivers/ide/pci/amd74xx.o.after
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drive->dn is initialized by ide-probe.c::probe_hwif() so no need to do it
in ->init_hwif method.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This belongs to user-space (and only if really needed).
text data bss dec hex filename
7129 404 8 7541 1d75 drivers/ide/pci/sis5513.o.before
3916 404 1 4321 10e1 drivers/ide/pci/sis5513.o.after
Additionaly to being bloat the code contained two bugs:
- wrong cable bit was checked (0x0001 instead of 0x8000) on ATA_133 chipsets
- incorrect UDMA cycle time was reported on ATA_100a/ATA_133 chipsets
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ATAPI devices with broken DMA support should be handled by DMA blacklist
and for debugging purposes we have new shiny "hdx=nodma" kernel paremeter.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add "hdx=nodma" option allowing user to disallow DMA for a given device.
* Obsolete "ide=nodma" option.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* hpt34x.c: disable DMA masks for HPT345
(hwif->autodma is zero so DMA won't be enabled anyway).
* trm290.c: disable IDE_HFLAG_TRUST_BIOS_FOR_DMA flag
(hwif->autodma is zero so DMA won't be enabled anyway).
* Check noautodma global variable instead of drive->autodma in ide_tune_dma().
This fixes handling of "ide=nodma" kernel parameter for icside, ide-cris,
au1xxx-ide, pmac, it821x, jmicron, sgiioc4 and siimage host drivers.
* Remove hwif->autodma (it was not checked by IDE core code anyway) and
drive->autodma (was set by all host drivers - except HPT345/TRM290 special
cases - unless "ide=nodma" was used).
While at it:
- remove needless printk() from icside.c
- remove stale FIXME/comment from ide-probe.c
- don't force DMA off if PCI bus-mastering had to be enabled in setup-pci.c
(this setting was always later over-ridden by host drivers anyway)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
It has been obsoleted since 1 Nov 2004, is valid only when used together with
"ide=nodma" kernel parameter (which makes no sense) and only for aec62xx,
cmd64x, cs5220, generic, hpt366, sl82c105, tc86c001 and triflex host drivers.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This code doesn't use pci_assign_resource() and ide_get_or_set_dma_base() uses
pci_resource_start() to get DMA base address so it has no chance of working.
Moreover this belongs to PCI quirks (in case somebody would like to fix it).
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
While at it:
- make struct pci_device_id tables const
- use PCI_DEVICE_ID_ITE_8213 define in it8213.c
- fix comment in generic.c
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Clear prefetch and postwrite for ATAPI devices instead of depending on BIOS.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Don't force PIO4 when programming UDMA mode (suggested by Sergei).
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
noautodma can now be unexported.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add IDE_HFLAG_TRUST_BIOS_FOR_DMA host flag for host drivers that depend
on BIOS for programming device/controller for DMA. Set it in cy82c693,
generic, ns87415, opti621 and trm290 host drivers.
* Add IDE_HFLAG_VDMA host flag for host drivers using VDMA. Set it in cs5520
host driver.
* Teach ide_tune_dma() about IDE_HFLAG_TRUST_BIOS_FOR_DMA flag.
* Add generic ide_dma_check() helper and remove all open coded ->ide_dma_check
implementations. Fix all places checking for presence of ->ide_dma_check
hook to check for ->ide_dma_on instead.
* Remove no longer needed code from config_drive_for_dma().
* Make ide_tune_dma() static.
v2:
* Fix config_drive_for_dma() return values.
* Fix ide-dma.c build for CONFIG_BLK_DEV_IDEDMA_PCI=n by adding
dummy config_drive_for_dma() inline.
* Fix IDE_HFLAG_TRUST_BIOS_FOR_DMA handling in ide_dma_check().
* Fix init_hwif_it8213() comment.
There should be no functionality changes caused by this patch.
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Since ide-pmac allows separate PIO and DMA timings, and ide-pmac always sets
->autotune this change shouldn't have any other effect than bringing ide-pmac
driver in-line with other host drivers wrt ->ide_dma_check implementation.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Since ide-cris allows separate PIO and DMA timings, and ide-cris always sets
->autotune this change shouldn't have any other effect than bringing ide-cris
driver in-line with other host drivers wrt ->ide_dma_check implementation.
Cc: Mikael Starvik <starvik@axis.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Since sl82c105 re-programs DMA/PIO timings for DMA enable/disable, and sets
->autotune this change shouldn't have any other effect than bringing sl82c105
driver in-line with other host drivers wrt ->ide_dma_check implementation.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add PIO autotune fallback to ->ide_dma_check.
Since cs5530/sc1200 allow separate PIO and DMA timings, and cs5530/sc1200
always set ->autotune this change shouldn't have any other effect than
bringing these drivers in-line with other host drivers wrt ->ide_dma_check
implementations.
* Fix ->ide_dma_check to return "-1" if DMA cannot be set.
* Bump driver version.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Remove ide_use_fast_pio() and just re-tune PIO unconditionally if DMA tuning
has failed in ->ide_dma_check. All host drivers using ide_use_fast_pio() set
drive->autotune so PIO is always tuned anyway and in some cases we _really_
need to re-tune PIO because PIO and DMA timings are shared.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Several host drivers used to reset drive->init_speed in their ->ide_dma_check
implementations which resulted in incorrect init speed being reported to the
user, fix it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Remove needless setting of drive->using_dma from auide_dma_check().
* Split off auide_mdma_filter() from auide_dma_check().
* Use ide_tune_dma() in auide_dma_check(), this fixes following issues:
- device's DMA capability bit not being checked
- device not being checked against generic DMA blacklist
- transfer mode not being set on device/host
* Add PIO autotune fallback to auide_dma_check().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Fix handling of unsupported/invalid modes in atiixp_set_dma_mode().
* ATI controllers allow separate PIO and DMA timings so remove programming
of PIO modes from atiixp_set_dma_mode(). Also remove no longer needed
atiixp_dma_2_pio() helper.
* SWDMA timings are not programmed by atiixp_set_dma_mode() and if SWDMA
mode is chosen atiixp_dma_host_on() erroneously enables UDMA, just disable
support for SWDMA modes for now.
* Enable support for MWDMA0 mode.
* Bump driver version.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Always set ->autotune in init_hwif_sis5513(), this means practically
no change in behavior since PIO was always tuned in ->ide_dma_check
and >autotune was always set for ->dma_base == 0 case.
* Bump driver version.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add sis_ata133_get_base() helper function for obtaining the address of
the drive control registers on chipset_family == ATA_133 chipsets.
* Add three helper functions for programming PIO/MWDMA timings:
- sis_ata16_program_timings() (for ATA_16/33/66/100a chipset families)
- sis_ata100_program_timings() (for ATA_100/133a chipset families)
- sis_ata133_program_timings() (for ATA_133 chipset family)
MWDMA timings are taken from datasheets and they match ATA spec.
* Add generic helper function sis_program_timings() and use it in
->set_pio_mode and ->set_dma_mode methods (previously the driver
depended on BIOS to program the correct MWDMA timings).
* Remove redundant !chipset_family check from init_hwif_sis5513()
(init_chipset_sis5513() guarantees that we will never get here if
chipset_family cannot be determined).
* SWDMA seems to be unsupported by SiS chipsets (no info about SWDMA in
datasheets and for SWDMA0 mode timing requirements are impossible to
fulfill) so remove ->swdma_mask from init_hwif_sis5513() and handling
of SWDMA modes from sis_set_dma_mode().
* Enable DMA support for chipset_family == ATA_16.
* Bump driver version.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This patch adds id strings for Corsair 1GB (identified as Hyperstone Model1)
inside legacy/ide-cs.c.
It also includes some minor whitespace cleanups.
Signed-off-by: Kristoffer Ericson <kristoffer.ericson@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
The patch described by the following excerpt from ChangeLog-2.6.22 makes
it impossible to use UDMA on a Tyan S2707 motherboard (SvrWks CSB5):
commit 2d5eaa6dd7
Author: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Date: Thu May 10 00:01:08 2007 +0200
ide: rework the code for selecting the best DMA transfer mode (v3)
...
This one-line patch against 2.6.23 fixes the problem.
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
init_dma_ali15x3() guarantees that hwif->dma_base will never be set for
m5229_revision < 0x20 so remove redundant m5229_revision >= 0x20 check from
init_hwif_common_ali15x3().
While at it remove incorrect comment.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Set hwif->atapi_dma/{ultra,mwdma}_mask and drive->autodma after checking that
->dma_base exists. If ->dma_base is not set (== PCI BAR4 cannot be reserved)
then DMA hooks shouldn't be initialized or bad things will happen.
OTOH hwif->set_{pio,dma}_mode hooks should be set even if hwif->dma_base == 0.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Set hwif->ide_dma_{check,on} and hwif->autodma to 1 after checking that
->dma_base exists. If ->dma_base is not set (== PCI BAR4 cannot be reserved)
then DMA hooks shouldn't be initialized or bad things will happen.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
If ->dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks
shouldn't be initialized or bad things will happen.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
If ->dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks
shouldn't be initialized or bad things will happen.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Devices which don't set word 93 validation bit should be now handled by
ide-iops.c::ivb_list[] and for debugging purposes cable detection can be
completely overriden with "idex=ata66" parameter.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Need to probe slave device first to make it release PDIAG-
(this is required for correct device side cable detection).
Based on libata commit f31f0cc2f0.
Thanks to Craig for testing this patch.
Cc: Craig Block <chblock3@yahoo.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Convert {ide_hwif_t,ide_pci_device_t}->host_flag to be u16.
* Add IDE_HFLAG_POST_SET_MODE host flag to indicate the need to program
the host for the transfer mode after programming the device. Set it
in au1xxx-ide, amd74xx, cs5530, cs5535, pdc202xx_new, sc1200, pmac
and via82cxxx host drivers.
* Add IDE_HFLAG_NO_SET_MODE host flag to indicate the need to completely
skip programming of host/device for the transfer mode ("smart" hosts).
Set it in it821x host driver and check it in ide_tune_dma().
* Add ide_set_pio_mode()/ide_set_dma_mode() helpers and convert all
direct ->set_pio_mode/->speedproc users to use these helpers.
* Move ide_config_drive_speed() calls from ->set_pio_mode/->speedproc
methods to callers.
* Rename ->speedproc method to ->set_dma_mode, make it void and update
all implementations accordingly.
* Update ide_set_xfer_rate() comments.
* Unexport ide_config_drive_speed().
v2:
* Fix issues noticed by Sergei:
- export ide_set_dma_mode() instead of moving ->set_pio_mode abuse wrt
to setting DMA modes from sc1200_set_pio_mode() to do_special()
- check IDE_HFLAG_NO_SET_MODE in ide_tune_dma()
- check for (hwif->set_pio_mode) == NULL in ide_set_pio_mode()
- check for (hwif->set_dma_mode) == NULL in ide_set_dma_mode()
- return -1 from ide_set_{pio,dma}_mode() if ->set_{pio,dma}_mode == NULL
- don't set ->set_{pio,dma}_mode on it821x in "smart" mode
- fix build problem in pmac.c
- minor fixes in au1xxx-ide.c/cs5530.c/siimage.c
- improve patch description
Changes in behavior caused by this patch:
- HDIO_SET_PIO_MODE ioctl would now return -ENOSYS for attempts to change
PIO mode if it821x controller is in "smart" mode
- removal of two debugging printk-s (from cs5530.c and sc1200.c)
- transfer modes 0x00-0x07 passed from user space may be programmed twice on
the device (not really an issue since 0x00 is not supported correctly by
any host driver ATM, 0x01 is not supported at all and 0x02-0x07 are invalid)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Check ide_config_drive_speed() return value.
* While at also call ide_config_drive_speed() if the transfer mode is
XFER_PIO_SLOW (this case happens iff the transfer mode has already been
set on the device by ide-proc.c::set_xfer_rate()) and remove redundant
setting of ->{init,current}_speed.
* Bump driver version.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Set transfer mode on the device before programming the host controller for
the new timings (matches what auide_tune_chipset() is doing wrt DMA modes).
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add "good DMA drives" hack for icside to ide-dma.c::ide_find_dma_mode()
(in the long-term it should be either removed or generalized for all hosts).
* Use ide_tune_dma() in icside.c::icside_dma_check().
This results in the following changes in behavior:
- pre-EIDE SWDMA modes are now also respected
- drive->autodma is checked instead of hwif->autodma
(doesn't really matter as icside sets both to "1")
* Make ide-dma.c::__ide_dma_good_drive() static and drop "__" prefix.
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add missing initialization of hwif->autodma and drive->autodma to
pmac_ide_setup_dma().
* Use ide_tune_dma() in pmac_ide_dma_check().
While at it:
* Fix pmac_ide_dma_check() return value if DMA mode is not programmed
(should be "-1" otherwise ide_set_dma() will try to enable DMA).
* Remove unnecessary drive->using_dma fiddling (->dma_off_quietly is always
called before ide_set_dma() call and ide_set_dma() calls ->ide_dma_on if
->ide_dma_check returns "0").
v2:
* No reason to blacklist all ide_floppy devices and the old code was always
enabling DMA anyway (without even programming controller/device if the
device was ide_floppy).
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Use ide_config_drive_speed() instead of pmac_ide_do_setfeature() and remove
the latter, also ide-iops.c::__ide_wait_stat() could be static again.
Since for IDE PMAC host driver IDE_CONTROL_REG is always true, device's
->quirk_list is always zero and ->ide_dma_host_{on,off} are nops than
the only changes in behavior are:
* if PIO mode is set then ->dma_off_queitly is called to disable DMA
* if setting transfer mode fails ide_dump_status() is called to dump status
v2:
* IDE PMAC controllers allow separate PIO and DMA timings and PPC userland
depends on this fact, and calls "hdparm -p" without calling "hdparm -d".
Therefore to compensate for DMA being disabled by ide_config_drive_speed()
for PIO modes:
- add IDE_HFLAG_SET_PIO_MODE_KEEP_DMA flag and set it in PMAC host driver
- add handling of the new flag to ide-io.c::do_special()
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Upper layers are responsible for controlling nIEN so don't clear nIEN after
command execution in pmac_ide_do_setfeature().
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Use __ide_wait_stat() instead of wait_for_ready() in pmac_ide_do_setfeature().
While at it do following changes to match __ide_wait_stat() call in
ide_config_drive_speed():
* Wait WAIT_CMD time (20 sec) instead of 2 sec for device to clear BUSY_STAT.
* Check DRQ_STAT bit (shouldn't be set for good device status).
Also remove no longer needed wait_for_ready() from ide-iops.c.
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Don't check for good device status before executing the command in
pmac_ide_do_setfeature() (ide_config_drive_speed() doesn't do this).
It is a job of upper layers to guarantee that the device is ready to
accept new command before we get here.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Split off checking of the status register from ide_wait_stat() to
__ide_wait_stat() helper.
* Use the new helper in ide_config_drive_speed(). The only change in the
functionality is that the function now fails if after 20 sec (WAIT_CMD)
device is still busy (BUSY_STAT bit is set) while previously instead of
failing the function continued with checking for the correct device status
(which would give the device additional 10 usec to clear BUSY_STAT bit).
* Remove stale comment for ide_config_drive_speed().
* Remove duplicate comment for ide_wait_stat() from <linux/ide.h>.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Fix pmac_ide_dma_check() to use pmac_ide_tune_chipset() and remove no longer
necessary pmac_ide_{m,u}dma_enable().
* While at it remove some dead code from pmac_ide_dma_check() (leftovers from
conversion to use ide_max_dma_mode()).
There should be no functionality changes caused by this patch.
v2:
* Fix compile by replacing "id" with "drive->id" in pmac_ide_dma_check()
(Noticed by Ben).
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
pmac_ide_do_setfeature() contains matching nIEN setting/clearing so this
Device Control register messing in pmac_ide_dma_check() is totally unnecessary.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Move adjusting of cycle time for devices providing explicit DMA cycle time
from pmac_ide_mdma_enable() to set_timings_mdma().
* Remove no longer needed drive_cycle_time argument.
* BUG() if unsupported speed argument value is passed (shouldn't happen).
* Matching access/recovery timings always exist so remove redundant check.
* Make set_timings_mdma() void.
* Update pmac_ide_tune_chipset()'s comment.
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Don't check check for pmif == NULL (it should never be NULL if we got here).
* Make a local copy of the timings and set the pmif->timings[] only after
setting the transfer mode on the device (otherwise SELECT_DRIVE() call in
pmac_ide_do_setfeature() will program new timings before the transfer mode
is set on the device - this was pointed out by Sergei). This change makes
pmac_ide_tune_chipset() behavior match this of pmac_ide_{m,u}dma_enable().
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
kauai_lookup_timing() should always return non-zero return value:
* BUG() in kauai_lookup_timing() if the timing info cannot be found.
* Remove code checking for zero return value from all callers.
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This patch removes the unused EXPORT_SYMBOL_GPL(ide_acpi_set_state)
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Shaohua Li <shaohua.li@intel.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
We need to set hwif->chipset or IDE PCI host drivers may try to claim
our ide_hwifs[] slot.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This changes the uevent buffer functions to use a struct instead of a
long list of parameters. It does no longer require the caller to do the
proper buffer termination and size accounting, which is currently wrong
in some places. It fixes a known bug where parts of the uevent
environment are overwritten because of wrong index calculations.
Many thanks to Mathieu Desnoyers for finding bugs and improving the
error handling.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (24 commits)
ide: use only ->set_pio_mode method for programming PIO modes (take 2)
sis5513: don't change UDMA settings when programming PIO
it8213/piix/slc90e66: don't change DMA settings when programming PIO
alim15x3: PIO mode setup fixes
siimage: fix ->set_pio_mode method to select PIO data transfer
cs5520: don't enable VDMA in ->speedproc
sc1200: remove redundant warning message from sc1200_tune_chipset()
ide-pmac: PIO mode setup fixes (take 3)
icside: fix ->speedproc to return on unsupported modes (take 5)
sgiioc4: use ide_tune_dma()
amd74xx/via82cxxx: use ide_tune_dma()
ide: add ide_set{_max}_pio() (take 4)
ide: Kconfig face-lift
ide: move ide_rate_filter() calls to the upper layer (take 2)
sis5513: add ->udma_filter method for chipset_family >= ATA_133
ide: mode limiting fixes for user requested speed changes
ide: add missing ide_rate_filter() calls to ->speedproc()-s
ide: call udma_filter() before resorting to the UltraDMA mask
ide: make jmicron match vendor and device class
pdc202xx_new: switch to using pci_get_slot() (take 2)
...
Use ->set_pio_mode method to program PIO modes in ide_set_xfer_rate()
(the only place which used ->speedproc to program PIO modes) and remove
handling of PIO modes from all ->speedproc implementations.
v2:
* Fix pmac_ide_tune_chipset() comment.
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Return failure in ->speedproc method for unsupported/invalid transfer
modes passed from user-space (fixes theoretical OOPS in ali_tune_pio()
and/or setting random PIO timings on host controller + disabling UDMA
bit + setting unsupported/invalid transfer mode on the device).
* Don't disable UDMA bit when programming PIO modes.
* Add FIXME about DMA timings never being set.
* Bump driver version.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Remember to select PIO data transfer (with IORDY monitored) in sil_tune_pio()
(->set_pio_mode method) so the controller is always programmed correctly for
PIO transfers (this is important if DMA is not going to be used).
* Don't set DMA/UDMA timings for PIO modes in siimage_tune_chipset().
* Bump driver version.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
There is no need to do it in cs5520_tune_chipset() (->speedproc method)
since it is correctly handled by cs5520_dma_on() (->ide_dma_on method).
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ide_config_drive_speed() called by sc1200_set_xfer_mode() already gives
a meaningful warning message in case of failure.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add { 0, 0 } entry to {kauai,shasta}_pio_timings[] so kauai_lookup_timing()
always returns a valid PIO timing (fixes PIO timing not being set for devices
with minimum PIO cycle <= 120ns).
* Add setting transfer mode on the device to pmac_ide_set_pio_mode().
* Fix pmac_ide_set_pio() to always program chipset for given PIO timing instead
of only when the device we want to program PIO timing for is the currently
selected one.
* Now that pmac_ide_set_pio() is fixed there is no need to set transfer mode
on the device and program chipset for PIO in pmac_ide_tune_chipset()
(returning 0 == success is not entirely correct but is OK for now since
the upper layers are only checking ->speedproc return value for DMA modes).
v2:
* s/speed/XFER_PIO_0 + pio/ in pmac_ide_set_pio_mode() so it actually compiles.
* Removal of kauai_lookup_timing() return value checking went to separate patch.
v3:
* Use XFER_PIO_0 not XFER_PIO. (Noticed by Ben)
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* All other implementations of ->speedproc return zero on success
and non-zero on failure. Currently it doesn't matter for icside host
driver and isn't a bug per se since:
- ide_set_xfer_rate() return value is ignored by all IDE core users
- icside doesn't (yet!) use ide_tune_dma() in icside_dma_check()
but sooner or later we will need to fix anyway - so lets do it now.
* icside_set_speed() happily accepts unsupported transfer modes which
results in drive->drive_data being set to the maximum value (480)
and drive->current_speed being set to the unsupported transfer mode.
Fix it.
v2:
* The initial version of the patch was broken because it didn't take into
the account (the different from usual) return values of icside_set_speed()
(Noticed by Russell).
v3:
* Remove no longer needed initialization/checking of cycle_time
(Noticed by Sergei).
* No need to set drive->drive_data if DMA is not going to be used
(Noticed by Sergei).
* Remove incorrect setting of drive->current_speed
(Noticed by Sergei).
* Move ide_config_drive_speed() at the end of icside_set_speed().
v4:
* If DMA mode is not found in icside_dma_check() then just return "-1" and
don't call icside_set_speed() (v3 got it wrong and "1" was returned instead).
v5:
* Return "-1"/"0" in icside_set_speed() instead of icside_dma_check() return
value (just like it was before this patch).
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add DRV_NAME define and use it instead of sgiioc4_chipset.name.
* Remove no longer needed sgiioc4_chipset.
* Remove needless clearing of ->atapi_dma from ide_dma_sgiioc4().
* Fix ide_dma_sgiioc4() to return success/failure. Check return value in
sgiioc4_ide_setup_pci_device() and set hwif->autodma accordingly. Also add
missing setting of drive->autodma.
* Add sgiioc4_speedproc() (implementation of ->speedproc method).
* Fix ->mwdma_mask (MWDMA2 mask is 0x04 not 0x02) and remove incorrect
->swdma_mask. Also remove needless initialization of ->ultra_mask.
* Use ide_tune_dma() in sgiioc4_ide_dma_check(), this fixes following bugs:
- DMA capability bit not being checked on the device
- DMA blacklist not being checked
- MWDMA2 mode support by device not being checked
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Jeremy Higdon <jeremy@sgi.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Use ide_tune_dma() in amd74xx/via82cxxx driver, this fixes following bugs:
- DMA capability bit not being checked on the device
- DMA blacklist not being checked
- DMA mode being programmed even if drive->autodma == 0
(thus possibly destroying PIO timings)
* Bump driver version.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add IDE_HFLAG_ABUSE_{PREFETCH,FAST_DEVSEL,DMA_MODES} flags
and set them in ht6560, cmd640, cmd64x and sc1200 host drivers.
* Add set_pio_mode_abuse() for checking if host driver has a non-standard
->tuneproc() implementation and use it in do_special().
* Add ide_set_pio() for setting PIO mode (it uses hwif->pio_mask to find
the maximum PIO mode supported by the host), also add ide_set_max_pio()
wrapper for ide_set_pio() to use for auto-tuning. Convert users of
->tuneproc to use ide_set{_max}_pio() where possible. This leaves only
do_special(), set_using_pio(), ide_hwif_restore() and ide_set_pio() as
a direct users of ->tuneproc.
* Remove no longer needed ide_get_best_pio_mode() calls and printk-s
reporting PIO mode selected from ->tuneproc implementations.
* Rename ->tuneproc hook to ->set_pio_mode and make 'pio' argument const.
* Remove stale comment from ide_config_drive_speed().
v2:
* Fix "ata_" prefix (Noticed by Jeff).
v3:
* Minor cleanups/fixups per Sergei's suggestions.
v4:
* Fix compile problem in drivers/ide/pci/cmd640.c
(Noticed by Andrew Morton).
* Improve some ->set_pio_mode comments.
Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Convert config options for PCI host drivers to select BLK_DEV_IDEPCI.
* Same for BLK_DEV_IDEDMA_PCI and PCI DMA host drivers, also make this
config option select BLK_DEV_IDEPCI.
* Remove no longer needed help for BLK_DEV_IDEPCI and BLK_DEV_IDEDMA_PCI.
* Remove redundant IDE_CHIPSETS config option.
As a result of this patch users have now three less config options
to worry about and can just select host drivers that they need
(IDE config menu is "flatter").
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Move ide_rate_filter() calls from host drivers to IDE core.
* Make ide_rate_filter() static.
* Make 'speed' argument of ->speedproc const.
v2:
* Fix it8213_tune_chipset() comment.
There should be no functionality changes caused by this patch.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add sis5513_ata133_udma_filter() for chipset_family >= ATA_133,
use it to filter UDMA6 mode if ATA133 bit is disabled.
* Remove no longer needed UDMA6 limiting logic from sis5513_tune_chipset().
* Bump driver version.
There should be no functionality changes caused by this patch.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add an extra argument to ide_max_dma_mode() for passing requested transfer
mode. Use it as an upper limit when finding the best DMA for device/host.
* Rename ide_max_dma_mode() to ide_find_dma_mode() and at the same time add
ide_max_dma_mode() wrapper which passes XFER_UDMA_6 as a requested mode to
ide_find_dma_mode(). Also add inline ide_find_dma_mode() version for
CONFIG_BLK_DEV_IDEDMA=n case.
* Pass requested transfer mode from ide_find_dma_mode() to ide_get_mode_mask()
to avoid false warning from eighty_ninty_three().
* Use ide_find_dma_mode() to limit the user requested transfer mode in
ide_rate_filter(). Also limit the requested mode by host max PIO mode.
Above changes make ide_rate_filter() to:
* Clip desired transfer mode down if it is invalid (values 0x0F, 0x13-0x19
and 0x25-0x39, values > 0x46 were already clipped down, same for values
0x25-0x39 but iff UDMA was not supported by the host).
* Clip desired transfer mode down if it is currently unsupported by IDE core
(PIO6 and MWDMA3-4, the latter were already clipped down but iff UDMA was
not supported by the host).
* Clip desired transfer mode down according to the host capabilities
(UDMA modes were already clipped down but MWDMA/SWDMA/PIO weren't,
also ->atapi_dma flag was not respected).
* Clip desired transfer mode down according to the device capabilities
(except PIO modes for now which require mode work) - shouldn't be a
problem since ide_set_xfer_rate() is called _after_ device has accepted
given transfer mode.
and also result in a number of host driver specific bugfixes:
* icside
- clip unsupported PIO5 mode down
- fix unsupported/invalid modes being set in drive->current_speed
* ide-cris
- clip unsupported PIO5 and SWDMA0-2 modes down
- clip DMA modes down for ATAPI devices
- fix BUG() on unsupported/invalid modes
* au1xxx-ide
- clip unsupported PIO5, SWDMA0-2 and MWDMA0-2
(if BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=n) modes down
* aec62xx
- clip unsupported PIO5 and SWDMA0-2 modes down
- clip DMA modes down for ATAPI devices
- fix 0x00 being programmed as PIO timing for unsupported/invalid modes
- fix unsupported/invalid modes being set on the device
* alim15x3
- clip DMA modes down for ATAPI devices (chipset revision == 0x20 only)
- fix theoretical OOPS for 0x0F mode
- fix unsupported/invalid modes being set on the device
* amd74xx
- clip unsupported SWDMA0-2 (on COBRA_7401 revs <= 7) modes down
- fix random PIO timings being set for unsupported/invalid modes
- fix unsupported/invalid modes being set on the device
* atiixp
- clip unsupported PIO5 and SWDMA0-2 modes down
- fix cached MWDMA mode being cleared for unsupported/invalid modes
- fix PIO{0,2} timings being programmed for unsupported/invalid modes
- fix theoretical OOPS for PIO5-6 and 0x0F modes
- fix unsupported/invalid modes being set on the device
* cmd64x
- clip unsupported SWDMA0-2 modes down
* cs5530
- clip unsupported PIO5 and SWDMA0-2 modes down
- fix unsupported/invalid modes being set on the device
- fix BUG() on unsupported/invalid modes
(which happened if the device accepted the setting)
* cs5535
- clip unsupported PIO5 and SWDMA0-2 modes down
- fix unsupported/invalid modes being set on the device
- fix theoretical OOPS for PIO5-6 and 0x0F modes
* hpt34x
- clip DMA modes down for ATAPI devices
- fix invalid timings being programmed for unsupported/invalid modes
- fix unsupported/invalid modes being set on the device
* hpt366
- clip unsupported PIO5 and SWDMA0-2 modes down
- fix PIO0 timings being programmed for unsupported/invalid modes
- fix DMA timings being cleared for MWDMA3-4 and 0x25-0x39 modes
- fix unsupported/invalid modes being set on the device
* it8213
- clip unsupported PIO5, SWDMA0-1 and MWDMA0 modes down
* it821x
- clip unsupported PIO5 and SWDMA0-2 modes down
- clip DMA modes down for ATAPI devices
(chipset in smart mode and revision 0x10 in pass-through mode)
* jmicron
- clip unsupported SWDMA0-2 modes down
- fix unsupported/invalid modes being set on the device
* pdc202xx_new
- clip unsupported PIO5 and SWDMA0-2 modes down
- fix unsupported/invalid modes being set on the device
* pdc202xx_old
- clip unsupported PIO5 mode down
- fix incorrect timings being set for unsupported/invalid modes
- fix unsupported/invalid modes being set on the device
* piix
- clip unsupported PIO5, SWDMA0-1 and MWDMA0 modes down
* sc1200
- clip unsupported PIO5 and SWDMA0-2 modes down
- fix unsupported/invalid modes being set on the device
- fix BUG() on unsupported/invalid modes
(which happened if the device accepted the setting)
* scc_pata
- clip unsupported PIO5, SWDMA0-2 and MWDMA0-2 modes down
* serverworks
- clip unsupported PIO5 and SWDMA0-2 modes down
- fix DMA/UDMA timings/settings being cleared for unsupported/invalid modes
- fix unsupported/invalid modes being set on the device
* siimage
- clip unsupported PIO5 and SWDMA0-2 modes down
- clip DMA modes down for ATAPI devices (SATA chipsets)
* sis5513
- clip unsupported PIO5 mode down
- fix BUG() on unsupported/invalid modes
* sl82c105
- clip unsupported SWDMA0-2 modes down
* slc90e66
- clip unsupported PIO5, SWDMA0-1 and MWDMA0 modes down
* tc86c001
- clip unsupported PIO5 and SWDMA0-2 modes down
- fix PIO0 timings being programmed for PIO5/0x0F/SWDMA0-2/0x13-0x19 modes
- fix invalid 0x00 DMA timing being programmed for MWDMA3-4/0x25-0x39 modes
- fix unsupported/invalid modes being set on the device
* triflex
- clip unsupported PIO5 mode down
* via82cxxx
- fix random PIO timings being set for unsupported/invalid modes
- fix unsupported/invalid modes being set on the device
* pmac
- clip unsupported PIO5 and SWDMA0-2 modes down
* cmd640/ht6560b
- clip DMA modes down (if CONFIG_BLK_DEV_IDEDMA=y)
- fix PIO5 being clipped to PIO4 (if CONFIG_BLK_DEV_IDEDMA=n)
* opti621
- clip DMA modes down (if CONFIG_BLK_DEV_IDEDMA=y)
- clip unsupported PIO4 to PIO3 (if CONFIG_BLK_DEV_IDEDMA=n)
While at it:
* Use ide_rate_filter() in cs5520.c::cs5520_tune_chipset().
* Remove no longer needed checks from hpt366.c::hpt3{6,7}x_tune_chipset().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Fix icside, cris-ide, au1xxx-ide, amd74xx, via82cxxx and pmac host drivers
to use ide_rate_filter().
This results in the following modes (from user requests) being clipped down:
- invalid modes (values 0x46-0xFF) [ for all hosts ]
- unsupported by a host UDMA modes [ for hosts which support UDMA]
- all UDMA modes and MWDMA3-4 modes [ for hosts which don't support UDMA ]
- invalid modes (values 0x25-0x39) [ for hosts which don't support UDMA ]
* Host driver specific changes in behavior:
icside:
- no change
cris-ide
- clip unsupported UDMA3-6 modes down
- fix BUG() on trying to set unsupported UDMA3-6 modes
au1xxx-ide/pmac
- clip unsupported UDMA modes down
amd74xx/via82cxxx
- clip unsupported UDMA modes down
- fix random PIO timings being set for unsupported/invalid modes
- fix unsupported/invalid modes being set on the device
* While at it remove no longer needed checks from pmac.c driver.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Give the udma_filter() method call precedence over using the mode masks.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
PATA part of all current JMB controllers behave the same way and
JMicron confirms that all future ones will stay compatible. Matching
vendor and device class is enough.
For backward compatibility, jmicron still needs to match 361,3,5,6,8
DIDs regardless of device class if libata is not configured but won't
need further DID update from this point.
Bart: cosmetic fixes to jmicron_chipset
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Ethan Hsiao <ethanhsiao@jmicron.com>
Cc: Justin Tsai <justin@jmicron.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Switch to using pci_get_slot() in init_setup_pdc20270() to get to the mate chip
behind DC21150 bridge as there's no need for the driver itself to walk the list
of the PCI devices (and the driver didn't check the bus # of the found device).
While at it, make it emit warning about IRQ # being fixed up (just like hpt366.c
does) and "beautify" this whole function as well as init_setup_pdc20276()...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
ACPI spec defines the sequence of IDE power on/off:
Powering down:
Call _GTM.
Power down drive (calls _PS3 method and turns off power planes).
Powering up:
Power up drive (calls _PS0 method if present and turns on power planes).
Call _STM passing info from _GTM (possibly modified), with ID data from
each drive.
Initialize the channel.
May modify the results of _GTF.
For each drive:
Call _GTF.
Execute task file (possibly modified).
This patch adds the missed _PS0/_PS3 methods call.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This is now very similar to pata_platform.c, they both use
same platform data structure and same resources.
To achieve that, byte_lanes_swapping platform data variable
and platform specified iops removed from that driver. It's fine,
since those were never used anyway.
pata_platform and ide_platform are carrying same driver names,
to easily switch between these drivers, without need to touch
platform code.
Bart:
- build fix from Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
The Marvell bridge chips used on HighPoint SATA cards do not seem to support
the MWDMA modes (at least that could be seen in their so-called drivers :-),
so the driver needs to account for this -- to achieve this:
- add mdma_filter() method from the original patch by Bartlomiej Zolnierkiewicz
with his consent;
- install the method for all chips to only return empty mask if a SATA drive
is detected on HPT372{AN]/374 chips...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
SB700 supports one physical IDE channel, but SB700 SATA controller
supports combined mode. When the SATA combined mode is enabled,
two SATA ports (port4 and port5) share one IDE channel from IDE
controller, and PATA will share the other IDE channel.
Our previous patch adding SB700 IDE device ID only supports one
IDE channel, which contains bug. The attached patch fixes the bug.
Signed-off-by: "Shane Huang" <Shane.Huang@amd.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Every usage of rq_for_each_bio wraps a usage of
bio_for_each_segment, so these can be combined into
rq_for_each_segment.
We define "struct req_iterator" to hold the 'bio' and 'index' that
are needed for the double iteration.
Signed-off-by: Neil Brown <neilb@suse.de>
Various compile fixes by me...
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Three main sets of changes:
1) dmi_get_system_info() return value should have been marked const,
since callers should not be changing that data.
2) const-ify DMI internals, since DMI firmware tables should,
whenever possible, be marked const to ensure we never ever write to
that data area.
3) const-ify DMI API, to enable marking tables const where possible
in low-level drivers.
And if we're really lucky, this might enable some additional
optimizations on the part of the compiler.
The bulk of the changes are #2 and #3, which are interrelated. #1 could
have been a separate patch, but it was so small compared to the others,
it was easier to roll it into this changeset.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
The PCI device table in the powermac IDE driver isn't properly
terminated. Depending on how your kernel is linked and other random
factors, you can end up with this driver matched against any other PCI
device in your system, possibly crashing at boot.
Thanks to Heikki for tracking this down with me, the bug have been there
for some time, though it rarely hurts due to luck. In this case, the
switch from .22 to .23-rc9 is causing it to show up due to differences
in the resulting layout of .data I suppose.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <pmac@au1.ibm.com>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Heikki Lindholm <holindho@cs.helsinki.fi>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Fix a bitmask typo in the pdc202xx_new PLL frequency detection code
which causes it to truncate an intermediate difference to 26 bits
instead of the correct 30 bits (the PLL's bitwidth).
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Port of Alan's patch for pata_via.c.
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Ensure that BLK_DEV_IDE is built-in before allowing BLK_DEV_IDE_PMAC to
be selected.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Cc: Bret Towe <magnade@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add Toshiba S1800-814 to whitelist for both pata_ali and alim15x3,
as it is correctly detected as 40-wire connected but this cable is
short enough to still use transfer modes higher than UDMA33.
Signed-off-by: Daniel Exner <dex@dragonslave.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
The Marvell bridge chips used on HighPoint SATA cards do not seem to support
the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes, so the driver needs
to account for this in the udma_filter() method. In order to achieve that, do
the following changes:
- install the method for all chips, not only HPT36x/370 and improve the code
formatting by killing the extra tabs while at it;
- add to the end of the 'switch' statement in the method cases for HPT372[AN]
and HPT374 chips upon which the known SATA cards are based;
- use hwif->ultra_mask as a default mask for the ide_dma_filter() method to
behave correctly;
- move the HPT370[A] cases below the HPT36x case for consistency.
While at it, replace the explicit UltraDMA mode masks with ATA_UDMA* constants
all over the driver...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Bob Ham <rah@bash.sh>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Make the SATA drive detection code from eighty_ninty_three() into inline
ide_dev_is_sata() helper fixing it along the way to be more strict while
checking word 80 for the reserved values...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
HPT374 BIOS seems to only save f_CNT register value for the function #0 before
re-tuning DPLL (that causes the driver to report obviously distorted f_CNT for
the function #1) -- fix this by always reading the saved f_CNT register value
from the function #0 in the driver's init_chipset() method.
While at it, introduce 'chip_type' for holding the 'struct hpt_info' field
of the same name and replace the structure assignment with memcpy()...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
The driver erroneously "lets go" the mate IDE chip in init_setup_pdc20270()
when ide_setup_pci_devices() call succeeds -- fix this, and drop a couple of
useless assignments in this function while at it...
Bart: keep "findev" variable initialization to silence gcc
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
The IDE core never marked the PCI IDE devices as being in use after succesfull
driver probe call (the devices were marked in use only while being probed), and
so was susceptible to issues caused by unsolicited PCI hotplug device removal.
So, add pci_dev_get() call to ide_scan_pcidev() and convert this function to
the kernel style, also dropping a bunch of useless curly braces from its caller,
ide_scan_pcibus() and somewhat beautifying printk() call there, while at it...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Currently the mpc8xx ide driver will only work on arch/ppc so only
allow it to be built there. Also, killed a minor include that isn't
actually used by the driver.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This disk reports total number of sectors instead of maximum sector address
in response to READ_NATIVE_MAX_ADDRESS command and also happily accepts
SET_MAX_ADDRESS command with the bogus value. This results in +1 sector
capacity being used and errors on attempts to use the last sector.
...
hdd: Host Protected Area detected.
    current capacity is 78165360 sectors (40020 MB)
    native  capacity is 78165361 sectors (40020 MB)
hdd: Host Protected Area disabled.
...
hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000
hdd: dma_intr: status=0x51 { DriveReady SeekComplete Error }
hdd: dma_intr: error=0x10 { SectorIdNotFound }, LBAsect=78165360, sector=78165360
...
Add hpa_list[] table and workaround the issue in idedisk_check_hpa().
v2:
* Add missing export and improve patch description a bit.
v3:
* Add list termination. (From Mikko)
Fixes kernel bugzilla bug #8816.
Thanks to Mikko for investigating the issue and helping with this patch.
Cc: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Programming DMA mode may destroy current PIO mode setting so if
CONFIG_HPT34X_AUTODMA=n (the default case) make ide_tune_dma() fail
early by disabling all host DMA masks and re-tune PIO mode.
This fix doesn't help with the driver being broken but is needed
for some other changes.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
If ->dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks
shouldn't be initialized or bad things will happen.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
If ->dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks
shouldn't be initialized or bad things will happen.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
If ->dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks
shouldn't be initialized or bad things will happen.
Also this host driver requires valid PCI BAR4 for normal operation so
check it in ->init_chipset and fail initialization if not set.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
If ->dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks
shouldn't be initialized or bad things will happen.
Also this host driver requires valid PCI BAR4 for normal operation so
check it in ->init_chipset and fail initialization if not set.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Use ->OUTBSYNC instead of ->OUTB when writing command register
(needed for scc_pata and pmac host drivers).
* Don't check DRDY bit of the status register on ATAPI devices
(ATAPI devices are free to ignore DRDY bit).
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Cc: Akira Iguchi <akira2.iguchi@toshiba.co.jp>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Move ide_in_drive_list() from ide-dma.c to ide-iops.c.
* Add ivb_list[] table for listening early UDMA66 devices which don't conform
to ATA4 standard wrt cable detection (bit14 is zero, only bit13 is valid)
and use only device side cable detection for them since host side cable
detection may be unreliable.
* Add model "QUANTUM FIREBALLlct10 05" with firwmare "A03.0900" to the list
(from Craig's bugreport).
v2:
* Improve kernel message basing on suggestion from Sergei.
v3:
* Don't print kernel message when no device side cable detection is done,
plus some minor fixes. (Noticed by Sergei)
Thanks to Craig for testing this patch.
Cc: Craig Block <chblock3@yahoo.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>