Patch re-ordering could be harmful:
commit 1fd1890594
Author: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Date: Sat Apr 26 22:25:24 2008 +0200
ide: add IDE_HFLAG_SERIALIZE_DMA host flag
...
is buggy because ->init_dma method / ide_hwif_setup_dma() is called
before IDE_HFLAG_SERIALIZE_DMA host flag is checked.
Fix it by checking IDE_HFLAG_SERIALIZE[_DMA] after DMA initialization.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
On Thursday 01 May 2008, Jeremy Kerr wrote:
> Hi all,
>
> On QS20 Cell machines, Linus' current git tree explodes on boot:
>
> SiI680: IDE controller (0x1095:0x0680 rev 0x02) at PCI slot
> 0000:00:0a.0
> SiI680: BASE CLOCK == 133
> SiI680: 100% native mode on irq 51
> ide0: MMIO-DMA
> ide1: MMIO-DMA
> Unable to handle kernel paging request for data at address
> 0xa000100081220080
> Faulting instruction address: 0xc000000000024748
> cpu 0x2: Vector: 300 (Data Access) at [c00000001e143420]
> pc: c000000000024748: ._insw_ns+0x10/0x30
> lr: c000000000037fc4: .spiderpci_readsw+0x24/0x6c
> sp: c00000001e1436a0
> msr: 9000000000001032
> dar: a000100081220080
> dsisr: 40000000
> current = 0xc00000003d060000
> paca = 0xc000000000623880
> pid = 1, comm = swapper
> enter ? for help
> [link register ] c000000000037fc4 .spiderpci_readsw+0x24/0x6c
> [c00000001e1436a0] c00000000062ce63 (unreliable)
> [c00000001e143730] c0000000000379d4 .iowa_readsw+0x78/0xa8
> [c00000001e1437c0] c000000000037a98 .iowa_insw+0x94/0xd4
> [c00000001e143850] c00000000022a190 .ata_input_data+0x298/0x2ec
> [c00000001e143910] c00000000022b600 .try_to_identify+0x2c0/0x6d4
> [c00000001e1439d0] c00000000022bb54 .do_probe+0x140/0x35c
> [c00000001e143a80] c00000000022bfbc .ide_probe_port+0x24c/0x670
> [c00000001e143b50] c00000000022d09c .ide_device_add_all+0x2ec/0x690
> [c00000001e143c00] c00000000022d4a4 .ide_device_add+0x64/0x74
> [c00000001e143c90] c00000000022f834 .ide_setup_pci_device+0x58/0x7c
> [c00000001e143d30] c00000000038bdf8
> [c00000001e143e10] c000000000486fb0 .ide_scan_pcibus+0x8c/0x178
> [c00000001e143ea0] c000000000460c00 .kernel_init+0x1c4/0x344
> [c00000001e143f90] c000000000024a1c .kernel_thread+0x4c/0x68
>
> It looks like we're trying to do PIO accesses (which appear to be
> broken, but that's another issue) to this MMIO device. In
> ata_input_data, we see that:
>
> u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
>
> Gives mmio == 0.
>
> (what's the difference between hwif->mmio and ID_HFLAG_MMIO?)
>
> In the siimage driver, hwif->host flags is initially set up correctly
> (host_flags includes IDE_HFLAG_MMIO), but we then *clear* this bit in
> ide_init_port:
>
> hwif->host_flags = d->host_flags;
>
> where d is the struct ide_port_info for this chipset. In my case,
> d->host_flags is 0x0. It looks like this will be the same for all of
> the siimage chipsets.
Don't over-write hwif->host_flags in ide_init_port(), some host drivers
set IDE_HFLAG_MMIO or IDE_HFLAG_NO_IO_32BIT host flag early.
Thanks to Jeremy Kerr for the excellent analysis of the bug.
Reported-by: Jeremy Kerr <jk@ozlabs.org>
Tested-by: Jeremy Kerr <jk@ozlabs.org>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Ben Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Always use ->OUTBSYNC method for executing commands so the posting is done
if needed (this affects only pmac and scc_pata host drivers at the moment).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Merge ->atapi_{in,out}put_bytes and ->ata_{in,out}put_data methods
into new ->{in,out}put_data methods which take number of bytes to
transfer as an argument and always do padding.
While at it:
* Use 'hwif' or 'drive->hwif' instead of 'HWIF(drive)'.
There should be no functional changes caused by this patch (all users
of ->ata_{in,out}put_data methods were using multiply-of-4 word counts).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add ->atapi_{in,out}put_bytes and ->ata_{in,out}put_data methods to
falconide and q40ide host drivers (->ata_* methods are implemented on
top of ->atapi_* methods so they also do byte-swapping now).
* Cleanup atapi_{in,out}put_bytes().
v2:
* Add 'struct request *rq' argument to ->ata_{in,out}put_data methods
and don't byte-swap disk fs requests (we shouldn't un-swap fs requests
because fs itself is stored byte-swapped on the disk) - this is how
things were done before the patch (ideally device mapper should be
used instead but it would break existing setups and would have some
performance impact).
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Richard Zidlicky <rz@linux-m68k.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add struct ide_io_ports and use it instead of `unsigned long io_ports[]`
in ide_hwif_t.
* Rename io_ports[] in hw_regs_t to io_ports_array[].
* Use un-named union for 'unsigned long io_ports_array[]' and 'struct
ide_io_ports io_ports' in hw_regs_t.
* Remove IDE_*_OFFSET defines.
v2:
* scc_pata.c build fix from Stephen Rothwell.
v3:
* Fix ctl_adrr typo in Sparc-specific part of ns87415.c.
(Noticed by Andrew Morton)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Don't set IDE_HFLAG_NO_AUTOTUNE host flag in sgiioc4 and icside
host drivers - there is no need for it as they don't implement
->set_pio_mode method.
* Remove no longer needed IDE_HFLAG_NO_AUTOTUNE host flag.
There should be no functional changes caused by this patch.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Remove obsoleted "hdx=noautotune" kernel parameter
(it has been obsoleted since 1 Nov 2004).
Then make ide_hwif_t.autotune a single bit flag
and remove no longer needed IDE_TUNE_* defines.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Remove obsoleted "idex=reset" kernel parameter
(it has been obsoleted since 1 Nov 2004).
Then remove corresponding code from ide_probe_port()
and no longer used ->reset field from ide_hwif_t.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add "ignore_cable" parameter:
* "ide_core.ignore_cable=[interface_number]" boot option if IDE is built-in
(i.e. "ide_core.ignore_cable=1" to force ignoring cable for "ide1")
* "ignore_cable=[interface_number]" module parameter (for ide_core module)
if IDE is compiled as module
v2:
* Add ide_port_apply_params() helper
- use it in ide_device_add_all() and ide_scan_port().
* Make it possible to later disable ignoring cable detection by passing
"[interface_number]:0" to /sys/module/ide_core/parameters/ignore_cable
(however sysfs interface is not enabled yet since it needs some other
IDE changes to make it work reliable).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add struct ide_dma_ops and convert core code + drivers to use it.
While at it:
* Drop "ide_" prefix from ->ide_dma_end and ->ide_dma_test_irq methods.
* Drop "ide_" "infixes" from DMA methods.
* au1xxx-ide.c:
- use auide_dma_{test_irq,end}() directly in auide_dma_timeout()
* pdc202xx_old.c:
- drop "old_" "infixes" from DMA methods
* siimage.c:
- add siimage_dma_test_irq() helper
- print SATA warning in siimage_init_one()
* Remove no longer needed ->init_hwif implementations.
v2:
* Changes based on review from Sergei:
- s/siimage_ide_dma_test_irq/siimage_dma_test_irq/
- s/drive->hwif/hwif/ in idefloppy_pc_intr().
- fix patch description w.r.t. au1xxx-ide changes
- fix au1xxx-ide build
- fix naming for cmd64*_dma_ops
- drop "ide_" and "old_" infixes
- s/hpt3xxx_dma_ops/hpt37x_dma_ops/
- s/hpt370x_dma_ops/hpt370_dma_ops/
- use correct DMA ops for HPT302/N, HPT371/N and HPT374
- s/it821x_smart_dma_ops/it821x_pass_through_dma_ops/
v3:
* Two bugs slipped in v2 (noticed by Sergei):
- use correct DMA ops for HPT374 (for real this time)
- handle HPT370/HPT370A properly
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add IDE_HFLAG_SERIALIZE_DMA host flag to serialize ports
if DMA is available and handle it in ide_init_port().
* Convert sl82c105 host driver to use this new flag.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Make ide_hwif_setup_dma() return an error value.
* Pass 'const struct ide_port_info *d' instead of 'unsigned long dmabase'
to ->init_dma method and make it return an error value.
* Rename ide_get_or_set_dma_base() to ide_pci_dma_base(),
change ordering of its arguments and then export it.
* Export ide_pci_set_master().
* Do complete DMA setup inside ->init_dma method and update ->init_dma
users accordingly.
* Sanitize code for DMA setup in ide_init_port().
v2:
* Fix for CONFIG_BLK_DEV_IDEDMA_PCI=n configs
(from Jiri Slaby <jirislaby@gmail.com>):
Fix following compiler warning by returning EINVAL:
In file included from ANYTHING-INCLUDING-IDE.H:45:
include/linux/ide.h: In function ‘ide_hwif_setup_dma’:
include/linux/ide.h:1022: warning: no return statement in function returning non-void
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
__FUNCTION__ is gcc-specific, use __func__
[bart: fix checkpatch.pl errors in ide-lib.c and ppc/mpc8xx.c while at it]
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
It is no longer needed to set hwif->mmio flag to tell IDE layer to not
manage resources so cleanup host drivers that used hwif->mmio flag only
for this purpose.
Ditto for ide_legacy_init_one().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Reserve PCI BARs 0-3 (0-1 for single port controllers) in
ide_pci_enable() and remove ide_hwif_request_regions() call
from ide_device_add_all() (also cleanup resource management
in scc_pata host driver).
* Fix handling of PCI BAR 4 in ide_pci_enable(), then cleanup
ide_iomio_dma() (+ init_hwif_trm290() in trm290 host driver)
and remove ide_release[_iomio]_dma().
v2:
* Fixup trm290 host driver.
v3:
* Because of scc_pata host driver changes we need to call
pci_request_selected_regions() also in setup_mmio_scc().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Tell IDE layer to not manage resources by setting hwif->mmio flag.
* Use {request,release}_region() for resources management.
* Set ->name field of 'struct ide_port_info' instances in legacy VLB
host drivers and use driver name for resources management.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Move the common code for primary/seconary port setup from
ide_legacy_device_add() to ide_legacy_init_one().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Tell IDE layer to not manage resources by setting hwif->mmio flag.
* Use {request,release}_region() for resources management.
* Use driver name for resources management.
* Remove no longer needed 'hwif->chipset == ide_4drives' handling
from ide_device_add_all().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add 'unsigned long config' argument to ide_legacy_device_add()
for setting hwif->config_data.
* Use ide_find_port_slot() instead of ide_find_port() in
ide_legacy_device_add().
* Handle IDE_HFLAG_QD_2ND_PORT and IDE_HFLAG_SINGLE host flags in
ide_legacy_device_add().
* Convert qd65xx host driver to use ide_legacy_device_add().
v2:
* Update ali14xx, dtc2278, ht6560b and umc8672 host drivers.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add ide_legacy_device_add() helper for use by legacy VLB host drivers
(+ convert them to use it).
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Update IDE PMAC host driver to use drive->noprobe instead of hwif->noprobe
and remove hwif->noprobe completely (it is always set to zero now).
There should be no functional changes caused by this patch.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Move hooks for port/host specific methods from ide_hwif_t to
'struct ide_port_ops'.
* Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info'
and ide_hwif_t.
* Update host drivers and core code accordingly.
While at it:
* Rename ata66_*() cable detect functions to *_cable_detect() to match
the standard naming. (Suggested by Sergei Shtylyov)
v2:
* Fix build for bast-ide. (Noticed by Andrew Morton)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add IDE_HFLAG_QD_2ND_PORT host flag to indicate the need of skipping
first ide_hwifs[] slot for the second port of QD65xx controller.
* Handle this new host flag in ide_find_port_slot().
* Convert legacy VLB host drivers to use ide_find_port().
While at it:
* Fix couple of printk()-s in qd65xx host driver to not use hwif->name.
v2:
* Fix qd65xx.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Change ide_match_hwif() argument from 'u8 bootable' to
'struct ide_port_info *d'.
* Move ide_match_hwif() to ide-probe.c from setup-pci.c and rename
it to ide_find_port_slot(). Update some comments while at it.
* ide_find_port() can be now just a wrapper for ide_find_port_slot().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS to drivers/ide/Kconfig and use
it instead of defining IDE_ARCH_OBSOLETE_DEFAULTS in <arch/ide.h>.
v2:
* Define ide_default_irq() in ide-probe.c/ns87415.c if not already defined
and drop defining ide_default_irq() for CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS=n.
[ Thanks to Stephen Rothwell and David Miller for noticing the problem. ]
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add IDE_{ALTSTATUS,IREASON,BCOUNTL,BCOUNTH}_OFFSET defines.
* Remove IDE_*_REG macros - this results in more readable
and slightly smaller code.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
request_irq() will fail if there is already another IRQ handler
registered and IRQ flags are mismatched.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add 'struct class ide_port_class' ('ide_port' class) and a 'struct
device *portdev' ('ide_port' class device) in ide_hwif_t.
* Register 'ide_port' class in ide_init() and unregister it in
cleanup_module().
* Create ->portdev in ide_register_port () and unregister it in
ide_unregister().
* Add "delete_devices" class device attribute for unregistering IDE devices
on a port and "scan" one for probing+registering IDE devices on a port.
* Add ide_sysfs_register_port() helper for registering "delete_devices"
and "scan" attributes with ->portdev. Call it in ide_device_add_all().
* Document IDE warm-plug support in Documentation/ide/warm-plug-howto.txt.
v2:
* Convert patch from using 'struct class_device' to use 'struct device'.
(thanks to Kay Sievers for doing it)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Rework PowerMac media-bay support in such way that instead of
un/registering the IDE interface we un/register IDE devices:
* Add ide_port_scan() helper for probing+registerering devices on a port.
* Rename ide_port_unregister_devices() to __ide_port_unregister_devices().
* Add ide_port_unregister_devices() helper for unregistering devices on a port.
* Add 'ide_hwif_t *cd_port' to 'struct media_bay_info', pass 'hwif' instead
of hwif->index to media_bay_set_ide_infos() and use it to setup 'cd_port'.
* Use ide_port_unregister_devices() instead of ide_unregister()
and ide_port_scan() instead of ide_register_hw() in media_bay_step().
* Unexport ide_register_hw() and make it static.
v2:
* Fix build by adding <linux/ide.h> include to <asm-powerpc/mediabay.h>.
(Reported by Michael/Kamalesh/Andrew).
Cc: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add ide_cfg_mtx lock/unlock to ide_port_setup_devices() and then move
ide_port_setup_devices() call from init_irq() to ide_device_add_all().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
IDE devices need to be removed from /proc/ide/ _before_ being unregistered:
* Drop 'ide_hwif_t *hwif' argument from destroy_proc_ide_device()
and use drive->hwif instead.
* Rename destroy_proc_ide_device() to ide_proc_unregister_device().
* Call ide_proc_unregister_device() in drive_release_dev().
* Remove no longer needed destroy_proc_ide_drives().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Factor out cable detection from ide_init_port() to ide_port_cable_detect().
* Move ide_port_cable_detect() call to ide_device_add_all().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This reverts commit b140b99c41.
[ conflict in drivers/ide/ide-probe.c fixed manually ]
It turned out that probing order change causes problems for some drives:
http://bugzilla.kernel.org/show_bug.cgi?id=10239
Since root causes are still being investigated and are unlikely to be fixed
before 2.6.25 lets revert this change for now. As a result cable detection
becomes less reliable when compared with 2.6.24 but the affected drives are
useable again.
Reported-by: Richard Genoud <richard.genoud@gmail.com>
Bisected-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Skip probing port if "hdx=noprobe" parameter was used for both devices on it.
* Obsolete "idex=noprobe" parameter - it only works for ide_generic, cmd640
and PCI hosts in Compatibility mode (on alpha/x86/ia64/m32r/mips/ppc32).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
After the APUS removal, some code can be removed.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Karsten Keil <kkeil@suse.de>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Cache value read from the Status register in 'stat' variable in do_probe()
and enable_nest(), then remove remove needless Status register reads.
While at it:
* Add proper KERN_* levels to printk() calls.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Un-static create_proc_ide_drives() and call it from ide_device_add_all().
While at it:
* Rename create_proc_ide_drives() to ide_proc_port_register_devices().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Move hwif->present check out from ide_proc_register_port() to
ide_device_add_all().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Factor out devices setup from ide_acpi_init() to
ide_acpi_port_init_devices().
* Call ide_acpi_port_init_devices() in ide_device_add_all().
While at it:
* Remove no longer needed 'drive' field from struct ide_acpi_drive_link.
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Factor out devices setup from init_irq() to ide_port_setup_devices().
While at it:
* Do devices setup after printing port information.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Factor out adding drive to hwgroup from init_irq() to
ide_add_drive_to_hwgroup().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Move hwif->rqsize init from ide_init_queue() to init_irq().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>