linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BK PATCHES] ide-2.6 update
@ 2004-12-30 22:32 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-12-30 22:32 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, linux-ide


Hi,

Please do a

 bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 Documentation/ide.txt          |    2 
 arch/i386/pci/irq.c            |    2 
 drivers/ide/ide-proc.c         |   15 ----
 drivers/ide/ide.c              |    5 -
 drivers/ide/pci/aec62xx.c      |   11 +-
 drivers/ide/pci/aec62xx.h      |    4 -
 drivers/ide/pci/alim15x3.c     |    3 
 drivers/ide/pci/amd74xx.c      |    9 +-
 drivers/ide/pci/atiixp.c       |    3 
 drivers/ide/pci/cmd64x.c       |    3 
 drivers/ide/pci/cs5530.c       |    3 
 drivers/ide/pci/cy82c693.c     |    5 -
 drivers/ide/pci/generic.c      |   15 ++--
 drivers/ide/pci/hpt34x.c       |    3 
 drivers/ide/pci/hpt366.c       |   33 ++++----
 drivers/ide/pci/hpt366.h       |    6 -
 drivers/ide/pci/it8172.c       |    5 -
 drivers/ide/pci/ns87415.c      |    3 
 drivers/ide/pci/opti621.c      |    7 -
 drivers/ide/pci/opti621.h      |    2 
 drivers/ide/pci/pdc202xx_new.c |   27 +++----
 drivers/ide/pci/pdc202xx_new.h |    6 -
 drivers/ide/pci/pdc202xx_old.c |   20 ++---
 drivers/ide/pci/pdc202xx_old.h |    6 -
 drivers/ide/pci/piix.c         |   10 +-
 drivers/ide/pci/piix.h         |    5 -
 drivers/ide/pci/rz1000.c       |    3 
 drivers/ide/pci/sc1200.c       |    3 
 drivers/ide/pci/serverworks.c  |   31 +-------
 drivers/ide/pci/serverworks.h  |    4 -
 drivers/ide/pci/sgiioc4.c      |   19 ++++-
 drivers/ide/pci/siimage.c      |    3 
 drivers/ide/pci/sis5513.c      |    3 
 drivers/ide/pci/sl82c105.c     |    3 
 drivers/ide/pci/slc90e66.c     |    3 
 drivers/ide/pci/triflex.c      |    4 -
 drivers/ide/pci/trm290.c       |    3 
 drivers/ide/pci/via82cxxx.c    |    3 
 drivers/ide/setup-pci.c        |  152 +++++++++++++++++++++++++++--------------
 include/linux/ide.h            |    6 -
 include/linux/pci_ids.h        |   24 ++++++
 41 files changed, 262 insertions(+), 215 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/12/30 1.2204)
   [patch] Intel ICH7 DID's, PIRQ and PATA support
   
   From: Jason Gaston <jason.d.gaston@intel.com>
   
   This patch adds the Intel ICH7 DID's to the pci_ids.h file
   and updates the piix driver and related files for PATA support.
   
   bart: this patch also adds PIRQ support
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/30 1.2203)
   [ide] make host drivers aware of the changes made to ide_setup_pci_device{s}
   
   - nothing clever here: the most noticeable change is the change of
     returned value for (*init_setup) in struct ide_pci_device_s which
     goes from void to int. Anything else is editing and checking for
     errors in the output of the compiler;
   - pci_disable_device() added for the error path in pci_init_sgiioc4();
   - BUG() removed in amd74xx_probe(): good old printk() is enough.
   
   Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/30 1.2202)
   [ide] propagate the error status in ide_pci_enable/ide_setup_pci_controller
   
   - no need to overwrite the status code returned by the pci_xyz() functions;
   - jump into the new century and use DMA_32BIT_MASK;
   - misc cleanup in the error paths. It should not add a huge value in
     ide_pci_enable() due to the FIXME comment but it should not bite too hard
     either.
   
   Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/30 1.2201)
   [ide] clean up error path in do_ide_setup_pci_device()
   
   ide_setup_pci_controller() puts the device in a PCI enabled state.
   The patch adds a small helper to balance it when things go wrong.
   
   Actually the helper does not *exactly* balance the setup: if it can
   not do a better job, ide_setup_pci_controller() may only enable some
   BARS whereas the new counterpart will try to disable everything.
   
   Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/30 1.2200)
   [ide] propagation of error code in PCI IDE setup
   
   - Change the return value and the prototype of do_ide_setup_pci_device
     Due to lack of appropriate return status code, the current clients of
     do_ide_setup_pci_device() can not distinguish a failing invocation
     from a successfull one. The patch modify do_ide_setup_pci_device() so
     that it can propagate some of the errors from the lower layers.
   
   - Make ide_setup_pci_device() aware of the change and propagate the news
     itself. I only gave a quick sight to create_proc_ide_interfaces() (and
     ide_remove_proc_entries()) but they do seem sane and it should not matter
     if it fails or not.
   
   - ide_setup_pci_devices(): mostly the same thing than ide_setup_pci_device().
     do not look trivially suspect.
   
   Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/30 1.2199)
   [ide] fix return codes in the generic PCI IDE driver
   
   From: Alan Cox <alan@redhat.com>
   
   This patch updates ide/pci/generic.c to fix the incorrect returns
   causing PCI devices to be left reserved wrongly by the driver.
   
   From: Francois Romieu <romieu@fr.zoreil.com>
   
   Use -ENODEV instead of -EAGAIN.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/30 1.2198)
   [ide] it8172: incorrect return from it8172_init_one()
   
   From: Alan Cox <alan@lxorguk.ukuu.org.uk>
   
   Several IDE drivers return positive values as errors in the PCI setup
   code. Unfortunately the PCI layer considers positive values as success
   so the driver skips the device but still claims it and things then go
   downhill.
   
   This fixes the IT8172 driver.
   
   From: Francois Romieu <romieu@fr.zoreil.com>
   
   Use -ENODEV instead of -EAGAIN.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/29 1.2197)
   [ide] fix cleanup_module() in ide.c
   
   DMA should be already released by ide_unregister()
   (unless interface is still busy).
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/29 1.2196)
   [ide] ide-proc: kill destroy_proc_ide_interfaces()
   
   /proc interface entries should be already unregistered
   by ide_unregister() (unless interface is still busy).
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/28 1.2195)
   [ide] serverworks: add support for CSB6 RAID
   
   From: Alan Cox <alan@lxorguk.ukuu.org.uk>
   
   The ServerWorks chips include a RAID variant that the 2.6 driver didn't
   support. This enables support for this and removes a pile of #if and
   other pointless obfuscations. This removes the need to use various
   vendor binary only drivers for CSB6 RAID.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/28 1.2194)
   [ide] add "ide=nodma" to documentation
   
   Here's a quick patch to add the currently-undocumented ide=nodma option
   to the Documentation/ide.txt file. Since the code does not mark this
   option as obsolete as far as I can see, I can only assume that it should
   be in the documentation
   
   Signed-off-by: Vadim Lobanov <vlobanov@speakeasy.net>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2005-04-02 15:22 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-04-02 15:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi Linus,

short ChangeLog:
* ide-default pseudo-driver is gone
* VIA resume failure is fixed

Bartlomiej

Please do a

 	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

  drivers/ide/ide-default.c   |   76 ---------------------------
  drivers/ide/Makefile        |    3 -
  drivers/ide/ide-cd.c        |   71 ++++++++++++++++---------
  drivers/ide/ide-cd.h        |    2
  drivers/ide/ide-disk.c      |   30 ++++++++--
  drivers/ide/ide-dma.c       |    8 ++
  drivers/ide/ide-floppy.c    |   48 ++++++++++++-----
  drivers/ide/ide-io.c        |   46 ++++++++++++----
  drivers/ide/ide-probe.c     |  122 +++++++++++++++++++++++---------------------
  drivers/ide/ide-proc.c      |   12 +---
  drivers/ide/ide-tape.c      |   41 ++++++++++++--
  drivers/ide/ide-taskfile.c  |   11 ++-
  drivers/ide/ide.c           |   86 ++++++++++++-------------------
  drivers/ide/pci/via82cxxx.c |    7 --
  drivers/scsi/ide-scsi.c     |   44 ++++++++++++---
  include/linux/ide.h         |    6 +-
  16 files changed, 338 insertions(+), 275 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (05/04/02 1.2351)
    [ide] fix via82cxxx resume failure

    With David Woodhouse <dwmw2@infradead.org>.

    On resume from sleep, via_set_speed() doesn't reinstate the correct
    mode, because it thinks the drive is already configured correctly.

    Also kill redundant printk, ide_config_drive_speed() warns about errors.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/04/02 1.2350)
    [ide] kill ide-default

    * add ide_drives list to list devices without a driver
    * add __ide_add_setting() and use it for adding no auto remove entries
    * kill ide-default pseudo-driver

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/04/02 1.2349)
    [ide] get driver from rq->rq_disk->private_data

    * add ide_driver_t * to device drivers objects
    * set it to point at driver's ide_driver_t
    * store address of this entry in disk->private_data
    * fix ide_{cd,disk,floppy,tape,scsi}_g accordingly
    * use rq->rq_disk->private_data instead of drive->driver
      to obtain driver (this allows us to kill ide-default)

    ide_dma_intr() OOPS fixed by Tejun Heo <htejun@gmail.com>.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/04/02 1.2348)
    [ide] kill ide_drive_t->disk

    * move ->disk from ide_drive_t to driver specific objects
    * make drivers allocate struct gendisk and setup rq->rq_disk
      (there is no need to do this for REQ_DRIVE_TASKFILE requests)
    * add ide_init_disk() helper and kill alloc_disks() in ide-probe.c
    * kill no longer needed ide_open() and ide_fops[] in ide.c

    ide_init_disk() fixed by Andrew Morton <akpm@osdl.org>.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/04/02 1.2347)
    [ide] add ide_{un}register_region()

    Add ide_{un}register_region() and fix ide-{tape,scsi}.c to register
    block device number ranges.  In ata_probe() only probe for modules.

    Behavior is unchanged because:
    * if driver is already loaded and attached to drive ata_probe()
      is not called et all
    * if driver is loaded by ata_probe() it will register new number range
      for a drive and this range will be found by kobj_lookup()

    If this is not clear please read http://lwn.net/Articles/25711/
    and see drivers/base/map.c.

    This patch makes it possible to move drive->disk allocation from
    ide-probe.c to device drivers.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/04/02 1.2346)
    [ide] destroy_proc_ide_device() cleanup

    When this function is called device is already unbinded from a
    driver so there are no driver /proc entries to remove.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/04/02 1.2345)
    [ide] drive->dsc_overlap fix

    drive->dsc_overlap is supported only by ide-{cd,tape} drivers.
    Add missing clearing of ->dsc_overlap to ide_{cd,tape}_release()
    and move ->dsc_overlap setup from ide_register_subdriver() to
    ide_cdrom_setup() (ide-tape enables it unconditionally).

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/04/02 1.2344)
    [ide] drive->nice1 fix

    It is drive's property independent of the driver being used so move
    drive->nice1 setup from ide_register_subdriver() to probe_hwif() in
    ide-probe.c.  As a result changing a driver which controls the drive
    no longer affects this flag.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2005-03-18 16:22 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-03-18 16:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi Linus,

Please do a

 	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

  Documentation/ioctl/hdio.txt |  179 ++++++++++++++++++++++++++++++++++---------
  drivers/ide/ide-cd.c         |   99 +++++++++++++++++++----
  drivers/ide/ide-cd.h         |    2
  drivers/ide/ide-disk.c       |   96 +++++++++++++++++++++--
  drivers/ide/ide-floppy.c     |  117 +++++++++++++++++++++-------
  drivers/ide/ide-tape.c       |  175 +++++++++++++++++++++++++++++++-----------
  drivers/ide/ide.c            |    3
  drivers/ide/pci/cs5520.c     |    3
  drivers/scsi/ide-scsi.c      |   66 +++++++++++++--
  include/linux/ide.h          |    2
  include/linux/pci_ids.h      |    1
  11 files changed, 594 insertions(+), 149 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (05/03/18 1.2239)
    [ide] ide-tape: fix character device ->open() vs ->cleanup() race

    Similar to the same race but for the block device.

    * store pointer to struct ide_tape_obj in idetape_chrdevs[]
    * rename idetape_chrdevs[] to idetape_devs[] and kill idetape_chrdev_t
    * add ide_tape_chrdev_get() for getting reference to the tape
    * store tape pointer in file->private_data and fix all users of it
    * fix idetape_chrdev_{open,release}() to get/put reference to the tape

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/18 1.2238)
    [ide] ide-scsi: add basic refcounting

    * pointers to a SCSI host and a drive are added to idescsi_scsi_t
    * pointer to the SCSI host is stored in disk->private_data
    * ide_scsi_{get,put}() is used to {get,put} reference to the SCSI host

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/18 1.2237)
    [ide] ide-tape: add basic refcounting

    Similar changes as for ide-cd.c.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/18 1.2236)
    [ide] ide-floppy: add basic refcounting

    Similar changes as for ide-cd.c.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/18 1.2235)
    [ide] ide-disk: add basic refcounting

    Similar changes as for ide-cd.c (except that struct ide_disk_obj is added).

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/18 1.2234)
    [ide] ide-cd: add basic refcounting

    * based on reference counting in drivers/scsi/{sd,sr}.c
    * fixes race between ->open() and ->cleanup() (ide_unregister_subdriver()
      tests for drive->usage != 0 but there is no protection against new users)
    * struct kref and pointer to a drive are added to struct ide_cdrom_info
    * pointer to drive's struct ide_cdrom_info is stored in disk->private_data
    * ide_cd_{get,put}() is used to {get,put} reference to struct ide_cdrom_info
    * ide_cd_release() is a release method for struct ide_cdrom_info

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/18 1.2233)
    [ide] make ide_generic_ioctl() take ide_drive_t * as an argument

    As a result disk->private_data can be used by device drivers now.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<htejun@gmail.com> (05/03/18 1.2232)
    [ide] hdio.txt update

    This patch updates Documentation/ioctl/hdio.txt to include more
    detailed descriptions about HDIO_DRIVE_{CMD|TASK|TASKFILE} ioctls.

    Signed-off-by: Tejun Heo <htejun@gmail.com>
    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tklauser@nuerscht.ch> (05/03/18 1.2231)
    [ide] drivers/ide/cs5520.c: use the DMA_{64,32}BIT_MASK constants

    Description: Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h
    when calling pci_set_dma_mask() or pci_set_consistent_dma_mask()
    See http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for details

    Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<Jason.d.gaston@intel.com> (05/03/18 1.2230)
    [ide] pci_ids.h correction for Intel ICH7R

    This patch removes an incorrect ICH7R DID in pci_ids.h.

    Signed-off-by: Jason Gaston <Jason.d.gaston@intel.com>
    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2005-03-10 17:45 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-03-10 17:45 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi Linus,

Please do a

 	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

  drivers/ide/Kconfig        |    1
  drivers/ide/ide-cd.c       |   58 ++++--------
  drivers/ide/ide-default.c  |   17 ++-
  drivers/ide/ide-disk.c     |  213 +++------------------------------------------
  drivers/ide/ide-floppy.c   |   15 ++-
  drivers/ide/ide-io.c       |  169 ++++++++++++++++++++++++++++++++++-
  drivers/ide/ide-iops.c     |   20 ++++
  drivers/ide/ide-probe.c    |   62 ++++++++++++-
  drivers/ide/ide-proc.c     |    8 -
  drivers/ide/ide-tape.c     |   21 +---
  drivers/ide/ide-taskfile.c |    6 -
  drivers/ide/ide.c          |   80 ----------------
  drivers/scsi/ide-scsi.c    |   11 ++
  include/linux/ide.h        |    6 -
  14 files changed, 329 insertions(+), 358 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (05/03/10 1.2016)
    [ide] kill setup_driver_defaults()

    * move default_do_request() to ide-default.c
    * fix drivers to set ide_driver_t->{do_request,end_request,error,abort}
    * kill setup_driver_defaults()

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/10 1.2015)
    [ide] kill ide_driver_t->capacity

    * add private /proc/ide/hd?/capacity handlers to ide-{cd,disk,floppy}.c
    * use generic proc_ide_read_capacity() for ide-{scsi,tape}.c
    * kill ->capacity, default_capacity() and generic_subdriver_entries[]

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/10 1.2014)
    [ide] kill ide_driver_t->pre_reset

    Add ide_drive_t->post_reset flag and use it to signal post reset
    condition to the ide-tape driver (the only user of ->pre_reset).

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/10 1.2013)
    [ide] fix some rare ide-default vs ide-disk races

    Some rare races between ide-default and ide-disk are possible, i.e.:
    * ide-default is used, I/O request is triggered (ie. /proc/ide/hd?/identify),
      drive->special is cleared silently (so CHS is not initialized properly),
      ide-disk is loaded and fails if drive uses CHS
    * ide-disk is used, drive is resetted, ide-disk is unloaded, ide-default
      takes control over drive and on the first I/O request silently clears
      drive->special without restoring settings

    Fix them by moving idedisk_{special,pre_reset}() and company to IDE core.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/10 1.2012)
    [ide] generic Power Management for IDE devices

    Move PM code from ide-cd.c and ide-disk.c to IDE core so:
    * PM is supported for other ATAPI devices (floppy, tape)
    * PM is supported even if specific driver is not loaded

    Also s/HWIF(drive)/drive->hwif/ while at it.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/03/10 1.2011)
    [ide] fix drive->ready_stat for ATAPI

    ATAPI devices ignore DRDY bit so drive->ready_stat must be set to zero.
    It is currently done by device drivers (including ide-default fake driver)
    but for PMAC driver it is too late as wait_for_ready() may be called during
    probe: probe_hwif()->pmac_ide_dma_check()->pmac_ide_{mdma,udma}_enable()->
    ->pmac_ide_do_setfeature()->wait_for_ready().

    Fixup drive->ready_stat just after detecting ATAPI device.

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bram.verweij@wanadoo.nl> (05/03/10 1.2010)
    [ide] fix DMA support for LBA48 disks on ALi15x3 (revs < 0xC5)

    From: Bram Verweij <bram.verweij@wanadoo.nl>

    The problem seems to be that ide-disk.c tries to use PIO mode for
    blocks > 137 GB (which is good), and LBA48 + DMA for blocks <= 137GB
    (which is known to be a problem, i.e., this is why the no_lba48_dma
    field was introduced in the first place).  Attached is a small patch
    that makes ide-disk.c use PIO mode for blocks > 137 GB, and LBA28 DMA
    (instead of LBA48 DMA) for blocks <= 137 GB.

    bart: argh, I forgot about 'lba48' flag; patch slightly modified by me

    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2005-02-24 11:20 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-02-24 11:20 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi Linus,

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/ide-disk.c   |   10 ++++------
 drivers/ide/ide-io.c     |    4 ++--
 drivers/ide/pci/hpt366.c |   29 +++++++++++------------------
 include/linux/ide.h      |    7 +++----
 4 files changed, 20 insertions(+), 30 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (05/02/24 1.2052)
   [ide] fix IRQ masking in ide_do_request()

   Revert to previous way of handling masked_irq argument.
   Reported to fix problems with shared PCI IRQs.

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/02/24 1.2051)
   [ide] fix build for built-in hpt366 and modular ide-disk

   * always call __ide_do_rw_disk() in ide_do_rw_disk()
   * modify ide_hwif_t->rw_disk hook accordingly
   * update and cleanup hpt372n_rw_disk()
     (the only user of ide_hwif_t->rw_disk hook)
   * make __ide_do_rw_disk() static + fix comment

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<rddunlap@osdl.org> (05/02/24 1.2050)
   [ide] make 1-bit fields unsigned

   It's a bit difficult to have a value and a sign bit in a
   1-bit field.

   Fix (90) boolean/bitfield sparse warnings:
   include/linux/ide.h:937:18: warning: dubious one-bit signed bitfield
   include/linux/ide.h:939:17: warning: dubious one-bit signed bitfield

   Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2005-02-24 12:05:25 +01:00
+++ b/drivers/ide/ide-disk.c	2005-02-24 12:05:25 +01:00
@@ -119,9 +119,8 @@
 /*
  * __ide_do_rw_disk() issues READ and WRITE commands to a disk,
  * using LBA if supported, or CHS otherwise, to address sectors.
- * It also takes care of issuing special DRIVE_CMDs.
  */
-ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block)
+static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
 	unsigned int dma	= drive->using_dma;
@@ -256,7 +255,6 @@
 		return pre_task_out_intr(drive, rq);
 	}
 }
-EXPORT_SYMBOL_GPL(__ide_do_rw_disk);

 /*
  * 268435455  == 137439 MB or 28bit limit
@@ -281,9 +279,9 @@
 		 block, rq->nr_sectors, (unsigned long)rq->buffer);

 	if (hwif->rw_disk)
-		return hwif->rw_disk(drive, rq, block);
-	else
-		return __ide_do_rw_disk(drive, rq, block);
+		hwif->rw_disk(drive, rq);
+
+	return __ide_do_rw_disk(drive, rq, block);
 }

 /*
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2005-02-24 12:05:25 +01:00
+++ b/drivers/ide/ide-io.c	2005-02-24 12:05:25 +01:00
@@ -1163,14 +1163,14 @@
 		 * happens anyway when any interrupt comes in, IDE or otherwise
 		 *  -- the kernel masks the IRQ while it is being handled.
 		 */
-		if (hwif->irq != masked_irq)
+		if (masked_irq != IDE_NO_IRQ && hwif->irq != masked_irq)
 			disable_irq_nosync(hwif->irq);
 		spin_unlock(&ide_lock);
 		local_irq_enable();
 			/* allow other IRQs while we start this request */
 		startstop = start_request(drive, rq);
 		spin_lock_irq(&ide_lock);
-		if (hwif->irq != masked_irq)
+		if (masked_irq != IDE_NO_IRQ && hwif->irq != masked_irq)
 			enable_irq(hwif->irq);
 		if (startstop == ide_stopped)
 			hwgroup->busy = 0;
diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
--- a/drivers/ide/pci/hpt366.c	2005-02-24 12:05:25 +01:00
+++ b/drivers/ide/pci/hpt366.c	2005-02-24 12:05:25 +01:00
@@ -1018,32 +1018,25 @@
 }

 /**
- *	hpt372n_rw_disk		-	wrapper for I/O
+ *	hpt372n_rw_disk		-	prepare for I/O
  *	@drive: drive for command
  *	@rq: block request structure
- *	@block: block number
- *
- *	This is called when a disk I/O is issued to the 372N instead
- *	of the default functionality. We need it because of the clock
- *	switching
  *
+ *	This is called when a disk I/O is issued to the 372N.
+ *	We need it because of the clock switching.
  */
-
-static ide_startstop_t hpt372n_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block)
+
+static void hpt372n_rw_disk(ide_drive_t *drive, struct request *rq)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	int wantclock;
-
-	if(rq_data_dir(rq) == READ)
-		wantclock = 0x21;
-	else
-		wantclock = 0x23;
-
-	if(HWIF(drive)->config_data != wantclock)
-	{
+
+	wantclock = rq_data_dir(rq) ? 0x23 : 0x21;
+
+	if (hwif->config_data != wantclock) {
 		hpt372n_set_clock(drive, wantclock);
-		HWIF(drive)->config_data = wantclock;
+		hwif->config_data = wantclock;
 	}
-	return __ide_do_rw_disk(drive, rq, block);
 }

 /*
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2005-02-24 12:05:25 +01:00
+++ b/include/linux/ide.h	2005-02-24 12:05:25 +01:00
@@ -797,7 +797,7 @@
 	struct pci_dev  *pci_dev;	/* for pci chipsets */
 	struct ide_pci_device_s	*cds;	/* chipset device struct */

-	ide_startstop_t (*rw_disk)(ide_drive_t *, struct request *, sector_t);
+	void (*rw_disk)(ide_drive_t *, struct request *);

 #if 0
 	ide_hwif_ops_t	*hwifops;
@@ -934,9 +934,9 @@
 		/* BOOL: protects all fields below */
 	volatile int busy;
 		/* BOOL: wake us up on timer expiry */
-	int sleeping	: 1;
+	unsigned int sleeping	: 1;
 		/* BOOL: polling active & poll_timeout field valid */
-	int polling	: 1;
+	unsigned int polling	: 1;
 		/* current drive */
 	ide_drive_t *drive;
 		/* ptr to current hwif in linked-list */
@@ -1318,7 +1318,6 @@
 extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);

 extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
-ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block);

 /*
  * ide_stall_queue() can be used by a drive to give excess bandwidth back

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2005-02-20 14:24 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-02-20 14:24 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi,

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/Kconfig  |    2 +-
 drivers/ide/ide-io.c |    5 +++--
 drivers/ide/ide.c    |    4 ++++
 3 files changed, 8 insertions(+), 3 deletions(-)

through these ChangeSets:

<ben-linux@fluff.org> (05/02/20 1.2130)
   [ide] Kconfig for VR1000 machine driver selection

   Fix the use of CONFIG_MACH_VR1000, which was missing an
   trailing zero from the configuration variable, so never
   being shown if only the VR1000 was selected

   Signed-off-by: Ben Dooks <ben-linux@fluff.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<mikukkon@gmail.com> (05/02/20 1.2129)
   [ide] small compile fix to ide.c with !CONFIG_PCI

   Small patch to fix following warning with CONFIG_IDE && !CONFIG_PCI:

     CC	drivers/ide/ide.o
   drivers/ide/ide.c: In function 'ide_system_bus_speed':
   drivers/ide/ide.c:338: warning: unused variable 'pci_default'

   I decided to save some bytes by #ifdef:ing the struct in question.
   CC:ing Hanna because she did the change (and just to say hi ;-).

   Signed-off-by: Mika Kukkonen <mikukkon@gmail.com>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/02/19 1.2128)
   [ide] fix ide_get_error_location() for LBA28

   Higher bits (16-23) of the address were ignored.

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig
--- a/drivers/ide/Kconfig	2005-02-20 15:08:56 +01:00
+++ b/drivers/ide/Kconfig	2005-02-20 15:08:56 +01:00
@@ -812,7 +812,7 @@

 config BLK_DEV_IDE_BAST
 	tristate "Simtec BAST / Thorcom VR1000 IDE support"
-	depends on ARM && (ARCH_BAST || MACH_VR100)
+	depends on ARM && (ARCH_BAST || MACH_VR1000)
 	help
 	  Say Y here if you want to support the onboard IDE channels on the
 	  Simtec BAST or the Thorcom VR1000
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2005-02-20 15:08:56 +01:00
+++ b/drivers/ide/ide-io.c	2005-02-20 15:08:56 +01:00
@@ -238,9 +238,10 @@
 		high = ide_read_24(drive);
 	} else {
 		u8 cur = HWIF(drive)->INB(IDE_SELECT_REG);
-		if (cur & 0x40)
+		if (cur & 0x40) {
+			high = cur & 0xf;
 			low = (hcyl << 16) | (lcyl << 8) | sect;
-		else {
+		} else {
 			low = hcyl * drive->head * drive->sect;
 			low += lcyl * drive->sect;
 			low += sect - 1;
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2005-02-20 15:08:56 +01:00
+++ b/drivers/ide/ide.c	2005-02-20 15:08:56 +01:00
@@ -335,10 +335,14 @@

 static int ide_system_bus_speed(void)
 {
+#ifdef CONFIG_PCI
 	static struct pci_device_id pci_default[] = {
 		{ PCI_DEVICE(PCI_ANY_ID, PCI_ANY_ID) },
 		{ }
 	};
+#else
+#define pci_default 0
+#endif /* CONFIG_PCI */

 	if (!system_bus_speed) {
 		if (idebus_parameter) {

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2005-02-06 14:03 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-02-06 14:03 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi,

This time two small bugfixes and removal of drivers/ide/pci/*.h.

Bartlomiej

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/pci/aec62xx.h      |  122 ----------
 drivers/ide/pci/cmd64x.h       |   95 --------
 drivers/ide/pci/cy82c693.h     |   83 -------
 drivers/ide/pci/generic.h      |  120 ----------
 drivers/ide/pci/hpt366.h       |  483 -----------------------------------------
 drivers/ide/pci/it8172.h       |   31 --
 drivers/ide/pci/opti621.h      |   28 --
 drivers/ide/pci/pdc202xx_new.h |  118 ----------
 drivers/ide/pci/pdc202xx_old.h |  144 ------------
 drivers/ide/pci/piix.h         |   62 -----
 drivers/ide/pci/serverworks.h  |   69 -----
 drivers/ide/ide-lib.c          |    3
 drivers/ide/ide-probe.c        |    3
 drivers/ide/pci/aec62xx.c      |  104 ++++++++
 drivers/ide/pci/cmd64x.c       |   84 +++++++
 drivers/ide/pci/cy82c693.c     |   71 +++++-
 drivers/ide/pci/generic.c      |   90 +++++++
 drivers/ide/pci/hpt366.c       |  435 ++++++++++++++++++++++++++++++++++++
 drivers/ide/pci/it8172.c       |   14 +
 drivers/ide/pci/opti621.c      |   20 +
 drivers/ide/pci/pdc202xx_new.c |  106 ++++++++
 drivers/ide/pci/pdc202xx_old.c |  129 ++++++++++
 drivers/ide/pci/piix.c         |   48 +++-
 drivers/ide/pci/serverworks.c  |   51 ++++
 include/linux/ide.h            |   14 -
 25 files changed, 1131 insertions(+), 1396 deletions(-)

through these ChangeSets:

<tj@home-tj.org> (05/02/06 1.2136)
   [ide] remove unused pkt_task_t definition from ide.h

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2135)
   [ide serverworks] merge serverworks.h into serverworks.c

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2134)
   [ide serverworks] remove unused SVWKS_DEBUG_DRIVE_INFO

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2133)
   [ide piix] merge piix.h into piix.c

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/02/06 1.2132)
   [ide piix] remove useless comment

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2131)
   [ide pdc202xx_old] merge pdc202xx_old.h into pdc202xx_old.c

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2130)
   [ide pdc202xx_old] remove SPLIT_BYTE() macro

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2129)
   [ide pdc202xx_new] merge pdc202xx_new.h into pdc202xx_new.c

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2128)
   [ide opti621] merge opti621.h into opti621.c

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2127)
   [ide it8172] merge it8172.h into it8172.c

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2126)
   [ide hpt366] merge hpt366.h into hpt366.c

   bart: while at it do whitespace cleanup and add missing FIXME

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/02/06 1.2125)
   [ide hpt366] remove dead fifty_base_hpt374[] table

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2124)
   [ide pci generic] merge generic.h into generic.c

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/02/06 1.2123)
   [ide pci generic] remove dummy init_chipset_generic()

   ->init_chipset is optional

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/02/06 1.2122)
   [ide pci generic] remove dead unknown_chipset[] table from generic.h

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2121)
   [ide cy82c693] merge cy82c693.h into cy82c693.c

   bart: do small whitespace cleanup while at it

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2120)
   [ide cmd64x] merge cmd64x.h into cmd64x.c

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2119)
   [ide aec62xx] merge aec62xx.h into aec62xx.c

   bart: s/byte/u8/

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/06 1.2118)
   [ide aec62xx] remove SPLIT_BYTE() and MAKE_WORD() macros

   bart: leave BUSCLOCK() alone for now

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<viro@parcelfarce.linux.theplanet.co.uk> (05/02/06 1.2117)
   [ide] fix ide_dump_atapi_status()

   From: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>

   On Fri, 4 Feb 2005, Al Viro wrote:

   > BTW, ide-lib.c code that triggers the ICE happens to be completely broken.
   > Jens, it's your patch from September 2002 - what used to be
   >        if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
   > became
   >        if ((status.all & (status.b.bsy|status.b.check)) == status.b.check) {
   > and that's *not* an equivalent transformation.  Fixing it doesn't get rid
   > of ICE, but it certainly deserves fixing.

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<khali@linux-fr.org> (05/02/06 1.2116)
   [ide] fix hwif_init() to not return error for "empty" interfaces

   Return success if no device is connected to the interface.

   Signed-off-by: Jean Delvare <khali@linux-fr.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>


^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2005-02-03 16:47 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-02-03 16:47 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi,

Here is late ide-2.6 update.  Various small fixes (mainly for nasty
corner cases, from Tejun Heo) and few trivial cleanups for which I
see no reason to wait for 2.6.11.  Please apply.

Bartlomiej

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/pci/adma100.c   |   30 -----------------------------
 drivers/ide/pci/adma100.h   |   28 ---------------------------
 drivers/ide/ide-disk.c      |    5 +---
 drivers/ide/ide-dma.c       |   26 ++++++++++---------------
 drivers/ide/ide-floppy.c    |    4 +--
 drivers/ide/ide-io.c        |   34 +++++++++++++++++----------------
 drivers/ide/ide-iops.c      |   45 ++++++++++++++++++++------------------------
 drivers/ide/ide-pnp.c       |    2 -
 drivers/ide/ide-probe.c     |    6 ++++-
 drivers/ide/ide-tape.c      |    2 -
 drivers/ide/ide-taskfile.c  |    4 +--
 drivers/ide/ide.c           |   10 ++++-----
 drivers/ide/legacy/ide-cs.c |    2 -
 drivers/ide/pci/Makefile    |    1
 drivers/ide/pci/it8172.c    |    4 +--
 drivers/ide/pci/it8172.h    |    3 --
 drivers/ide/pci/opti621.c   |    5 ----
 drivers/ide/pci/opti621.h   |    3 --
 drivers/ide/pci/piix.c      |   16 ---------------
 drivers/ide/pci/piix.h      |    3 --
 drivers/ide/pci/sgiioc4.c   |    3 +-
 drivers/ide/pci/siimage.c   |    2 -
 drivers/scsi/ide-scsi.c     |    8 +++----
 include/linux/ide.h         |   24 +++--------------------
 24 files changed, 83 insertions(+), 187 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (05/02/03 1.2009)
   [ide] fix printk in ide_allocate_dma_engine()

   With Olaf Hering <olh@suse.de>.

   Parameters were interchanged.

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<prarit@sgi.com> (05/02/03 1.2008)
   [ide] fix error handling in probe_hwif_init() and sgiioc4 driver

   From: Prarit Bhargava <prarit@sgi.com>

   I discovered an issue where a hwif_init() failure lead to /proc/ide files
   being created for devices that failed probes.  This resulted in
   oops/WARN_ON/BUG_ON executions through the kernel depending on what
   actions were on going.

   slightly changed by me (bart)

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.2007)
   [ide] add ide_hwgroup_t.polling

   ide_hwgroup_t.polling field added.  0 in poll_timeout field
   used to indicate inactive polling but because 0 is a valid
   jiffy value, though slim, there's a chance that something
   weird can happen.

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.2006)
   [ide] add ide_drive_t.sleeping

   ide_drive_t.sleeping field added.  0 in sleep field used to
   indicate inactive sleeping but because 0 is a valid jiffy
   value, though slim, there's a chance that something can go
   weird.  And while at it, explicit jiffy comparisons are
   converted to use time_before() macros.

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.2005)
   [ide] comment fixes

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.2004)
   [ide] remove NULL checking in ide_error()

   In ide_error(), drive cannot be NULL.  ide_dump_status() can't
   handle NULL drive.

   From: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.2003)
   [ide] ide-tape: use time_after() macro

   Explicit jiffy comparision converted to time_after() macro.

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.2002)
   [ide] __ide_do_rw_disk() return value fix

   In __ide_do_rw_disk(), ide_started used to be returned blindly
   after issusing PIO write.  This can cause hang if
   pre_task_out_intr() returns ide_stopped due to failed
   ide_wait_stat() test.  Fixed to pass the return value of
   pre_task_out_intr().

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.2001)
   [ide] __ide_do_rw_disk() lba48 dma check fix

   In __ide_do_rw_disk(), the shifted block, instead of the
   original rq->sector, should be used when checking range for
   lba48 dma.

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.2000)
   [ide] cleanup piix

   In drivers/ide/pci/piix.[hc], init_setup_piix() is defined and
   used but only one init_setup function is defined and no
   demultiplexing is done using init_setup callback.  As other
   drivers call ide_setup_pci_device() directly in such cases,
   this patch removes init_setup_piix() and makes piix_init_one()
   call ide_setup_pci_device() directly.

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.1999)
   [ide] cleanup opti621

   In drivers/ide/pci/opti612.[hc], init_setup_opti621() is
   declared, defined and referenced but never actually used.
   This patch removes the function.

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/02/03 1.1998)
   [ide] fix it8172 build for real

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.1997)
   [ide] cleanup it8172

   In drivers/ide/pci/it8172.h, it8172_ratefilter() and
   init_setup_it8172() are declared and the latter is referenced
   in it8172_chipsets.  Both functions are not defined or used
   anywhere.  This patch removes the prototypes and reference.
   it8172 should be compilable now.

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<tj@home-tj.org> (05/02/03 1.1996)
   [ide] remove adma100

   Removes drivers/ide/pci/adma100.[hc].  The driver isn't
   compilable (missing functions) and no Kconfig actually enables
   CONFIG_BLK_DEV_ADMA100.

   On Wed, 02 Feb 2005 03:31:59 -0500, Jeff Garzik <jgarzik@pobox.com> wrote:
   > Also, the libata-dev-2.6 tree has an "ata_adma" driver which is
   > complete, but needs some testing (and I have h/w).

   Signed-off-by: Tejun Heo <tj@home-tj.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bunk@stusta.de> (05/02/03 1.1995)
   [ide] possible cleanups

   This patch contains the following possible cleanups:
   - make some needlessly global code static
   - ide-dma.c: remove the unneeded EXPORT_SYMBOL(__ide_dma_test_irq)

   slightly changed by me (bart)

   Signed-off-by: Adrian Bunk <bunk@stusta.de>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<arjan@infradead.org> (05/02/03 1.1994)
   [ide] unexport atapi_*_bytes() and ide_read_24()

   From: Arjan van de Ven <arjan@infradead.org>

   * make atapi_{input,output}_bytes() static, fix users to use drive->hwif
   * remove ide_read_24() export; it's unused since the ide-io.c reorganization
   * add a FIXME comment to the ide_fix_driveid() export

   slightly changed by me (bart)

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bunk@stusta.de> (05/02/02 1.1993)
   [ide] remove WAIT_READY dependency on APM

   On the one hand APM isn't enabled on all laptops.
   On the other hand, this also affects regular PCs with APM support (or
   using a distribution kernel with APM support).

   The time for the !APM case was already increased from 30msec in 2.4 .
   Isn't there a timeout that is suitable for all cases?

   Alan Cox answered:
   > The five seconds should be just fine for all cases. The smaller value
   > with no
   > power manglement should help speed up recovery however. It probably
   > doesn't belong CONFIG_APM now ACPI and friends are involved either.

   Until someone has a real good solution (consider e.g. that most PC users
   might have ACPI support enabled), this patch unconditionally sets
   WAIT_READY to 5 seconds.

   Signed-off-by: Adrian Bunk <bunk@stusta.de>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/ide-disk.c	2005-02-03 17:02:35 +01:00
@@ -132,7 +132,7 @@
 	nsectors.all		= (u16) rq->nr_sectors;

 	if (hwif->no_lba48_dma && lba48 && dma) {
-		if (rq->sector + rq->nr_sectors > 1ULL << 28)
+		if (block + rq->nr_sectors > 1ULL << 28)
 			dma = 0;
 	}

@@ -253,8 +253,7 @@
 		/* FIXME: ->OUTBSYNC ? */
 		hwif->OUTB(command, IDE_COMMAND_REG);

-		pre_task_out_intr(drive, rq);
-		return ide_started;
+		return pre_task_out_intr(drive, rq);
 	}
 }
 EXPORT_SYMBOL_GPL(__ide_do_rw_disk);
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/ide-dma.c	2005-02-03 17:02:35 +01:00
@@ -227,7 +227,9 @@
  *	the PRD table that the IDE layer wants to be fed. The code
  *	knows about the 64K wrap bug in the CS5530.
  *
- *	Returns 0 if all went okay, returns 1 otherwise.
+ *	Returns the number of built PRD entries if all went okay,
+ *	returns 0 otherwise.
+ *
  *	May also be invoked from trm290.c
  */

@@ -631,7 +633,7 @@
 EXPORT_SYMBOL(__ide_dma_end);

 /* returns 1 if dma irq issued, 0 otherwise */
-int __ide_dma_test_irq (ide_drive_t *drive)
+static int __ide_dma_test_irq(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
 	u8 dma_stat		= hwif->INB(hwif->dma_status);
@@ -650,8 +652,6 @@
 			drive->name, __FUNCTION__);
 	return 0;
 }
-
-EXPORT_SYMBOL(__ide_dma_test_irq);
 #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */

 int __ide_dma_bad_drive (ide_drive_t *drive)
@@ -784,7 +784,7 @@
 /*
  * Needed for allowing full modular support of ide-driver
  */
-int ide_release_dma_engine (ide_hwif_t *hwif)
+static int ide_release_dma_engine(ide_hwif_t *hwif)
 {
 	if (hwif->dmatable_cpu) {
 		pci_free_consistent(hwif->pci_dev,
@@ -796,7 +796,7 @@
 	return 1;
 }

-int ide_release_iomio_dma (ide_hwif_t *hwif)
+static int ide_release_iomio_dma(ide_hwif_t *hwif)
 {
 	if ((hwif->dma_extra) && (hwif->channel == 0))
 		release_region((hwif->dma_base + 16), hwif->dma_extra);
@@ -820,7 +820,7 @@
 	return ide_release_iomio_dma(hwif);
 }

-int ide_allocate_dma_engine (ide_hwif_t *hwif)
+static int ide_allocate_dma_engine(ide_hwif_t *hwif)
 {
 	hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev,
 						  PRD_ENTRIES * PRD_BYTES,
@@ -830,14 +830,13 @@
 		return 0;

 	printk(KERN_ERR "%s: -- Error, unable to allocate%s DMA table(s).\n",
-		(hwif->dmatable_cpu == NULL) ? " CPU" : "",
-		hwif->cds->name);
+			hwif->cds->name, !hwif->dmatable_cpu ? " CPU" : "");

 	ide_release_dma_engine(hwif);
 	return 1;
 }

-int ide_mapped_mmio_dma (ide_hwif_t *hwif, unsigned long base, unsigned int ports)
+static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int ports)
 {
 	printk(KERN_INFO "    %s: MMIO-DMA ", hwif->name);

@@ -852,7 +851,7 @@
 	return 0;
 }

-int ide_iomio_dma (ide_hwif_t *hwif, unsigned long base, unsigned int ports)
+static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int ports)
 {
 	printk(KERN_INFO "    %s: BM-DMA at 0x%04lx-0x%04lx",
 		hwif->name, base, base + ports - 1);
@@ -881,10 +880,7 @@
 	return 0;
 }

-/*
- *
- */
-int ide_dma_iobase (ide_hwif_t *hwif, unsigned long base, unsigned int ports)
+static int ide_dma_iobase(ide_hwif_t *hwif, unsigned long base, unsigned int ports)
 {
 	if (hwif->mmio == 2)
 		return ide_mapped_mmio_dma(hwif, base,ports);
diff -Nru a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
--- a/drivers/ide/ide-floppy.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/ide-floppy.c	2005-02-03 17:02:35 +01:00
@@ -585,7 +585,7 @@
 			count = min(bvec->bv_len, bcount);

 			data = bvec_kmap_irq(bvec, &flags);
-			atapi_input_bytes(drive, data, count);
+			drive->hwif->atapi_input_bytes(drive, data, count);
 			bvec_kunmap_irq(data, &flags);

 			bcount -= count;
@@ -619,7 +619,7 @@
 			count = min(bvec->bv_len, bcount);

 			data = bvec_kmap_irq(bvec, &flags);
-			atapi_output_bytes(drive, data, count);
+			drive->hwif->atapi_output_bytes(drive, data, count);
 			bvec_kunmap_irq(data, &flags);

 			bcount -= count;
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/ide-io.c	2005-02-03 17:02:35 +01:00
@@ -555,7 +555,7 @@

 	err = ide_dump_status(drive, msg, stat);

-	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
+	if ((rq = HWGROUP(drive)->rq) == NULL)
 		return ide_stopped;

 	/* retry only "normal" I/O: */
@@ -933,6 +933,7 @@
 	if (timeout > WAIT_WORSTCASE)
 		timeout = WAIT_WORSTCASE;
 	drive->sleep = timeout + jiffies;
+	drive->sleeping = 1;
 }

 EXPORT_SYMBOL(ide_stall_queue);
@@ -972,18 +973,18 @@
 	}

 	do {
-		if ((!drive->sleep || time_after_eq(jiffies, drive->sleep))
+		if ((!drive->sleeping || time_after_eq(jiffies, drive->sleep))
 		    && !elv_queue_empty(drive->queue)) {
 			if (!best
-			 || (drive->sleep && (!best->sleep || 0 < (signed long)(best->sleep - drive->sleep)))
-			 || (!best->sleep && 0 < (signed long)(WAKEUP(best) - WAKEUP(drive))))
+			 || (drive->sleeping && (!best->sleeping || time_before(drive->sleep, best->sleep)))
+			 || (!best->sleeping && time_before(WAKEUP(drive), WAKEUP(best))))
 			{
 				if (!blk_queue_plugged(drive->queue))
 					best = drive;
 			}
 		}
 	} while ((drive = drive->next) != hwgroup->drive);
-	if (best && best->nice1 && !best->sleep && best != hwgroup->drive && best->service_time > WAIT_MIN_SLEEP) {
+	if (best && best->nice1 && !best->sleeping && best != hwgroup->drive && best->service_time > WAIT_MIN_SLEEP) {
 		long t = (signed long)(WAKEUP(best) - jiffies);
 		if (t >= WAIT_MIN_SLEEP) {
 		/*
@@ -992,10 +993,9 @@
 		 */
 			drive = best->next;
 			do {
-				if (!drive->sleep
-				/* FIXME: use time_before */
-				 && 0 < (signed long)(WAKEUP(drive) - (jiffies - best->service_time))
-				 && 0 < (signed long)((jiffies + t) - WAKEUP(drive)))
+				if (!drive->sleeping
+				 && time_before(jiffies - best->service_time, WAKEUP(drive))
+				 && time_before(WAKEUP(drive), jiffies + t))
 				{
 					ide_stall_queue(best, min_t(long, t, 10 * WAIT_MIN_SLEEP));
 					goto repeat;
@@ -1058,14 +1058,17 @@
 		hwgroup->busy = 1;
 		drive = choose_drive(hwgroup);
 		if (drive == NULL) {
-			unsigned long sleep = 0;
+			int sleeping = 0;
+			unsigned long sleep = 0; /* shut up, gcc */
 			hwgroup->rq = NULL;
 			drive = hwgroup->drive;
 			do {
-				if (drive->sleep && (!sleep || 0 < (signed long)(sleep - drive->sleep)))
+				if (drive->sleeping && (!sleeping || time_before(drive->sleep, sleep))) {
+					sleeping = 1;
 					sleep = drive->sleep;
+				}
 			} while ((drive = drive->next) != hwgroup->drive);
-			if (sleep) {
+			if (sleeping) {
 		/*
 		 * Take a short snooze, and then wake up this hwgroup again.
 		 * This gives other hwgroups on the same a chance to
@@ -1105,7 +1108,7 @@
 		}
 		hwgroup->hwif = hwif;
 		hwgroup->drive = drive;
-		drive->sleep = 0;
+		drive->sleeping = 0;
 		drive->service_start = jiffies;

 		if (blk_queue_plugged(drive->queue)) {
@@ -1311,7 +1314,7 @@
 			/* local CPU only,
 			 * as if we were handling an interrupt */
 			local_irq_disable();
-			if (hwgroup->poll_timeout != 0) {
+			if (hwgroup->polling) {
 				startstop = handler(drive);
 			} else if (drive_is_ready(drive)) {
 				if (drive->waiting_for_dma)
@@ -1439,8 +1442,7 @@
 		return IRQ_NONE;
 	}

-	if ((handler = hwgroup->handler) == NULL ||
-	    hwgroup->poll_timeout != 0) {
+	if ((handler = hwgroup->handler) == NULL || hwgroup->polling) {
 		/*
 		 * Not expecting an interrupt from this drive.
 		 * That means this could be:
diff -Nru a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
--- a/drivers/ide/ide-iops.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/ide-iops.c	2005-02-03 17:02:35 +01:00
@@ -184,16 +184,6 @@

 EXPORT_SYMBOL(default_hwif_mmiops);

-void default_hwif_transport (ide_hwif_t *hwif)
-{
-	hwif->ata_input_data		= ata_input_data;
-	hwif->ata_output_data		= ata_output_data;
-	hwif->atapi_input_bytes		= atapi_input_bytes;
-	hwif->atapi_output_bytes	= atapi_output_bytes;
-}
-
-EXPORT_SYMBOL(default_hwif_transport);
-
 u32 ide_read_24 (ide_drive_t *drive)
 {
 	u8 hcyl = HWIF(drive)->INB(IDE_HCYL_REG);
@@ -202,8 +192,6 @@
 	return (hcyl<<16)|(lcyl<<8)|sect;
 }

-EXPORT_SYMBOL(ide_read_24);
-
 void SELECT_DRIVE (ide_drive_t *drive)
 {
 	if (HWIF(drive)->selectproc)
@@ -240,7 +228,7 @@
  * of the sector count register location, with interrupts disabled
  * to ensure that the reads all happen together.
  */
-void ata_vlb_sync (ide_drive_t *drive, unsigned long port)
+static void ata_vlb_sync(ide_drive_t *drive, unsigned long port)
 {
 	(void) HWIF(drive)->INB(port);
 	(void) HWIF(drive)->INB(port);
@@ -250,7 +238,7 @@
 /*
  * This is used for most PIO data transfers *from* the IDE interface
  */
-void ata_input_data (ide_drive_t *drive, void *buffer, u32 wcount)
+static void ata_input_data(ide_drive_t *drive, void *buffer, u32 wcount)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
 	u8 io_32bit		= drive->io_32bit;
@@ -272,7 +260,7 @@
 /*
  * This is used for most PIO data transfers *to* the IDE interface
  */
-void ata_output_data (ide_drive_t *drive, void *buffer, u32 wcount)
+static void ata_output_data(ide_drive_t *drive, void *buffer, u32 wcount)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
 	u8 io_32bit		= drive->io_32bit;
@@ -299,7 +287,7 @@
  * extra byte allocated for the buffer.
  */

-void atapi_input_bytes (ide_drive_t *drive, void *buffer, u32 bytecount)
+static void atapi_input_bytes(ide_drive_t *drive, void *buffer, u32 bytecount)
 {
 	ide_hwif_t *hwif = HWIF(drive);

@@ -316,9 +304,7 @@
 		hwif->INSW(IDE_DATA_REG, ((u8 *)buffer)+(bytecount & ~0x03), 1);
 }

-EXPORT_SYMBOL(atapi_input_bytes);
-
-void atapi_output_bytes (ide_drive_t *drive, void *buffer, u32 bytecount)
+static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount)
 {
 	ide_hwif_t *hwif = HWIF(drive);

@@ -335,7 +321,15 @@
 		hwif->OUTSW(IDE_DATA_REG, ((u8*)buffer)+(bytecount & ~0x03), 1);
 }

-EXPORT_SYMBOL(atapi_output_bytes);
+void default_hwif_transport(ide_hwif_t *hwif)
+{
+	hwif->ata_input_data		= ata_input_data;
+	hwif->ata_output_data		= ata_output_data;
+	hwif->atapi_input_bytes		= atapi_input_bytes;
+	hwif->atapi_output_bytes	= atapi_output_bytes;
+}
+
+EXPORT_SYMBOL(default_hwif_transport);

 /*
  * Beginning of Taskfile OPCODE Library and feature sets.
@@ -437,6 +431,7 @@
 #endif
 }

+/* FIXME: exported for use by the USB storage (isd200.c) code only */
 EXPORT_SYMBOL(ide_fix_driveid);

 void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
@@ -1028,14 +1023,14 @@
 			return ide_started;
 		}
 		/* end of polling */
-		hwgroup->poll_timeout = 0;
+		hwgroup->polling = 0;
 		printk("%s: ATAPI reset timed-out, status=0x%02x\n",
 				drive->name, stat);
 		/* do it the old fashioned way */
 		return do_reset1(drive, 1);
 	}
 	/* done polling */
-	hwgroup->poll_timeout = 0;
+	hwgroup->polling = 0;
 	return ide_stopped;
 }

@@ -1095,7 +1090,7 @@
 			printk("\n");
 		}
 	}
-	hwgroup->poll_timeout = 0;	/* done polling */
+	hwgroup->polling = 0;	/* done polling */
 	return ide_stopped;
 }

@@ -1112,7 +1107,7 @@
 #endif
 }

-void pre_reset (ide_drive_t *drive)
+static void pre_reset(ide_drive_t *drive)
 {
 	DRIVER(drive)->pre_reset(drive);

@@ -1170,6 +1165,7 @@
 		udelay (20);
 		hwif->OUTB(WIN_SRST, IDE_COMMAND_REG);
 		hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
+		hwgroup->polling = 1;
 		__ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL);
 		spin_unlock_irqrestore(&ide_lock, flags);
 		return ide_started;
@@ -1210,6 +1206,7 @@
 	/* more than enough time */
 	udelay(10);
 	hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
+	hwgroup->polling = 1;
 	__ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL);

 	/*
diff -Nru a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
--- a/drivers/ide/ide-pnp.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/ide-pnp.c	2005-02-03 17:02:35 +01:00
@@ -21,7 +21,7 @@
 #include <linux/ide.h>

 /* Add your devices here :)) */
-struct pnp_device_id idepnp_devices[] = {
+static struct pnp_device_id idepnp_devices[] = {
   	/* Generic ESDI/IDE/ATA compatible hard disk controller */
 	{.id = "PNP0600", .driver_data = 0},
 	{.id = ""}
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/ide-probe.c	2005-02-03 17:02:35 +01:00
@@ -841,7 +841,11 @@
 	if (fixup)
 		fixup(hwif);

-	hwif_init(hwif);
+	if (!hwif_init(hwif)) {
+		printk(KERN_INFO "%s: failed to initialize IDE interface\n",
+				 hwif->name);
+		return -1;
+	}

 	if (hwif->present) {
 		u16 unit = 0;
diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- a/drivers/ide/ide-tape.c	2005-02-03 17:02:34 +01:00
+++ b/drivers/ide/ide-tape.c	2005-02-03 17:02:35 +01:00
@@ -2439,7 +2439,7 @@
 			tape->dsc_polling_start = jiffies;
 			tape->dsc_polling_frequency = tape->best_dsc_rw_frequency;
 			tape->dsc_timeout = jiffies + IDETAPE_DSC_RW_TIMEOUT;
-		} else if ((signed long) (jiffies - tape->dsc_timeout) > 0) {
+		} else if (time_after(jiffies, tape->dsc_timeout)) {
 			printk(KERN_ERR "ide-tape: %s: DSC timeout\n",
 				tape->name);
 			if (rq->cmd[0] & REQ_IDETAPE_PC2) {
diff -Nru a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
--- a/drivers/ide/ide-taskfile.c	2005-02-03 17:02:34 +01:00
+++ b/drivers/ide/ide-taskfile.c	2005-02-03 17:02:34 +01:00
@@ -851,8 +851,8 @@
 		hwif->OUTB(taskfile->high_cylinder, IDE_HCYL_REG);

         /*
-	 * (ks) In the flagged taskfile approch, we will used all specified
-	 * registers and the register value will not be changed. Except the
+	 * (ks) In the flagged taskfile approch, we will use all specified
+	 * registers and the register value will not be changed, except the
 	 * select bit (master/slave) in the drive_head register. We must make
 	 * sure that the desired drive is selected.
 	 */
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2005-02-03 17:02:34 +01:00
+++ b/drivers/ide/ide.c	2005-02-03 17:02:34 +01:00
@@ -333,7 +333,7 @@
  *	Returns a guessed speed in MHz.
  */

-int ide_system_bus_speed (void)
+static int ide_system_bus_speed(void)
 {
 	static struct pci_device_id pci_default[] = {
 		{ PCI_DEVICE(PCI_ANY_ID, PCI_ANY_ID) },
@@ -414,7 +414,7 @@
 #ifdef CONFIG_PROC_FS
 struct proc_dir_entry *proc_ide_root;

-ide_proc_entry_t generic_subdriver_entries[] = {
+static ide_proc_entry_t generic_subdriver_entries[] = {
 	{ "capacity",	S_IFREG|S_IRUGO,	proc_ide_read_capacity,	NULL },
 	{ NULL, 0, NULL, NULL }
 };
@@ -1675,7 +1675,7 @@
  *
  * Remember to update Documentation/ide.txt if you change something here.
  */
-int __init ide_setup (char *s)
+static int __init ide_setup(char *s)
 {
 	int i, vals[3];
 	ide_hwif_t *hwif;
@@ -2261,7 +2261,7 @@
 /*
  * This is gets invoked once during initialization, to set *everything* up
  */
-int __init ide_init (void)
+static int __init ide_init(void)
 {
 	printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n");
 	devfs_mk_dir("ide");
@@ -2308,7 +2308,7 @@
 }

 #ifdef MODULE
-char *options = NULL;
+static char *options = NULL;
 module_param(options, charp, 0);
 MODULE_LICENSE("GPL");

diff -Nru a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
--- a/drivers/ide/legacy/ide-cs.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/legacy/ide-cs.c	2005-02-03 17:02:35 +01:00
@@ -209,7 +209,7 @@
 #define CS_CHECK(fn, ret) \
 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)

-void ide_config(dev_link_t *link)
+static void ide_config(dev_link_t *link)
 {
     client_handle_t handle = link->handle;
     ide_info_t *info = link->priv;
diff -Nru a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile
--- a/drivers/ide/pci/Makefile	2005-02-03 17:02:34 +01:00
+++ b/drivers/ide/pci/Makefile	2005-02-03 17:02:34 +01:00
@@ -1,5 +1,4 @@

-obj-$(CONFIG_BLK_DEV_ADMA100)		+= adma100.o
 obj-$(CONFIG_BLK_DEV_AEC62XX)		+= aec62xx.o
 obj-$(CONFIG_BLK_DEV_ALI15X3)		+= alim15x3.o
 obj-$(CONFIG_BLK_DEV_AMD74XX)		+= amd74xx.o
diff -Nru a/drivers/ide/pci/adma100.c b/drivers/ide/pci/adma100.c
--- a/drivers/ide/pci/adma100.c	2005-02-03 17:02:35 +01:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,30 +0,0 @@
-/*
- *  linux/drivers/ide/pci/adma100.c -- basic support for Pacific Digital ADMA-100 boards
- *
- *     Created 09 Apr 2002 by Mark Lord
- *
- *  This file is subject to the terms and conditions of the GNU General Public
- *  License.  See the file COPYING in the main directory of this archive for
- *  more details.
- */
-
-#include <linux/mm.h>
-#include <linux/blkdev.h>
-#include <linux/hdreg.h>
-#include <linux/ide.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <asm/io.h>
-
-void __init ide_init_adma100 (ide_hwif_t *hwif)
-{
-	unsigned long  phy_admctl = pci_resource_start(hwif->pci_dev, 4) + 0x80 + (hwif->channel * 0x20);
-	void *v_admctl;
-
-	hwif->autodma = 0;		// not compatible with normal IDE DMA transfers
-	hwif->dma_base = 0;		// disable DMA completely
-	hwif->io_ports[IDE_CONTROL_OFFSET] += 4;	// chip needs offset of 6 instead of 2
-	v_admctl = ioremap_nocache(phy_admctl, 1024);	// map config regs, so we can turn on drive IRQs
-	*((unsigned short *)v_admctl) &= 3;		// enable aIEN; preserve PIO mode
-	iounmap(v_admctl);				// all done; unmap config regs
-}
diff -Nru a/drivers/ide/pci/adma100.h b/drivers/ide/pci/adma100.h
--- a/drivers/ide/pci/adma100.h	2005-02-03 17:02:35 +01:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,28 +0,0 @@
-#ifndef ADMA_100_H
-#define ADMA_100_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-extern void init_setup_pdcadma(struct pci_dev *, ide_pci_device_t *);
-extern unsigned int init_chipset_pdcadma(struct pci_dev *, const char *);
-extern void init_hwif_pdcadma(ide_hwif_t *);
-extern void init_dma_pdcadma(ide_hwif_t *, unsigned long);
-
-static ide_pci_device_t pdcadma_chipsets[] __devinitdata = {
-	{
-		.vendor		= PCI_VENDOR_ID_PDC,
-		.device		= PCI_DEVICE_ID_PDC_1841,
-		.name		= "ADMA100",
-		.init_setup	= init_setup_pdcadma,
-		.init_chipset	= init_chipset_pdcadma,
-		.init_hwif	= init_hwif_pdcadma,
-		.init_dma	= init_dma_pdcadma,
-		.channels	= 2,
-		.autodma	= NODMA,
-		.bootable	= OFF_BOARD,
-	}
-}
-
-#endif /* ADMA_100_H */
diff -Nru a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c
--- a/drivers/ide/pci/it8172.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/pci/it8172.c	2005-02-03 17:02:35 +01:00
@@ -56,7 +56,7 @@
 {
 	ide_hwif_t *hwif	= HWIF(drive);
 	struct pci_dev *dev	= hwif->pci_dev;
-	int is_slave		= (hwif->drives[1] == drive);
+	int is_slave		= (&hwif->drives[1] == drive);
 	unsigned long flags;
 	u16 drive_enables;
 	u32 drive_timing;
@@ -94,7 +94,7 @@
 	}

 	pci_write_config_word(dev, 0x40, drive_enables);
-	spin_unlock_irqrestore(&ide_lock, flags)
+	spin_unlock_irqrestore(&ide_lock, flags);
 }

 static u8 it8172_dma_2_pio (u8 xfer_rate)
diff -Nru a/drivers/ide/pci/it8172.h b/drivers/ide/pci/it8172.h
--- a/drivers/ide/pci/it8172.h	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/pci/it8172.h	2005-02-03 17:02:35 +01:00
@@ -6,7 +6,6 @@
 #include <linux/ide.h>

 static u8 it8172_ratemask(ide_drive_t *drive);
-static u8 it8172_ratefilter(ide_drive_t *drive, u8 speed);
 static void it8172_tune_drive(ide_drive_t *drive, u8 pio);
 static u8 it8172_dma_2_pio(u8 xfer_rate);
 static int it8172_tune_chipset(ide_drive_t *drive, u8 xferspeed);
@@ -14,14 +13,12 @@
 static int it8172_config_chipset_for_dma(ide_drive_t *drive);
 #endif

-static void init_setup_it8172(struct pci_dev *, ide_pci_device_t *);
 static unsigned int init_chipset_it8172(struct pci_dev *, const char *);
 static void init_hwif_it8172(ide_hwif_t *);

 static ide_pci_device_t it8172_chipsets[] __devinitdata = {
 	{	/* 0 */
 		.name		= "IT8172G",
-		.init_setup	= init_setup_it8172,
 		.init_chipset	= init_chipset_it8172,
 		.init_hwif	= init_hwif_it8172,
 		.channels	= 2,
diff -Nru a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
--- a/drivers/ide/pci/opti621.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/pci/opti621.c	2005-02-03 17:02:35 +01:00
@@ -348,11 +348,6 @@
 	hwif->drives[1].autodma = hwif->autodma;
 }

-static int __init init_setup_opti621 (struct pci_dev *dev, ide_pci_device_t *d)
-{
-	return ide_setup_pci_device(dev, d);
-}
-
 static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	return ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]);
diff -Nru a/drivers/ide/pci/opti621.h b/drivers/ide/pci/opti621.h
--- a/drivers/ide/pci/opti621.h	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/pci/opti621.h	2005-02-03 17:02:35 +01:00
@@ -5,13 +5,11 @@
 #include <linux/pci.h>
 #include <linux/ide.h>

-static int init_setup_opti621(struct pci_dev *, ide_pci_device_t *);
 static void init_hwif_opti621(ide_hwif_t *);

 static ide_pci_device_t opti621_chipsets[] __devinitdata = {
 	{	/* 0 */
 		.name		= "OPTI621",
-		.init_setup	= init_setup_opti621,
 		.init_hwif	= init_hwif_opti621,
 		.channels	= 2,
 		.autodma	= AUTODMA,
@@ -19,7 +17,6 @@
 		.bootable	= ON_BOARD,
 	},{	/* 1 */
 		.name		= "OPTI621X",
-		.init_setup	= init_setup_opti621,
 		.init_hwif	= init_hwif_opti621,
 		.channels	= 2,
 		.autodma	= AUTODMA,
diff -Nru a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
--- a/drivers/ide/pci/piix.c	2005-02-03 17:02:34 +01:00
+++ b/drivers/ide/pci/piix.c	2005-02-03 17:02:34 +01:00
@@ -531,20 +531,6 @@
 }

 /**
- *	init_setup_piix		-	callback for IDE initialize
- *	@dev: PIIX PCI device
- *	@d: IDE pci info
- *
- *	Enable the xp fixup for the PIIX controller and then perform
- *	a standard ide PCI setup
- */
-
-static int __devinit init_setup_piix(struct pci_dev *dev, ide_pci_device_t *d)
-{
-	return ide_setup_pci_device(dev, d);
-}
-
-/**
  *	piix_init_one	-	called when a PIIX is found
  *	@dev: the piix device
  *	@id: the matching pci id
@@ -557,7 +543,7 @@
 {
 	ide_pci_device_t *d = &piix_pci_info[id->driver_data];

-	return d->init_setup(dev, d);
+	return ide_setup_pci_device(dev, d);
 }

 /**
diff -Nru a/drivers/ide/pci/piix.h b/drivers/ide/pci/piix.h
--- a/drivers/ide/pci/piix.h	2005-02-03 17:02:34 +01:00
+++ b/drivers/ide/pci/piix.h	2005-02-03 17:02:34 +01:00
@@ -5,14 +5,12 @@
 #include <linux/pci.h>
 #include <linux/ide.h>

-static int init_setup_piix(struct pci_dev *, ide_pci_device_t *);
 static unsigned int __devinit init_chipset_piix(struct pci_dev *, const char *);
 static void init_hwif_piix(ide_hwif_t *);

 #define DECLARE_PIIX_DEV(name_str) \
 	{						\
 		.name		= name_str,		\
-		.init_setup	= init_setup_piix,	\
 		.init_chipset	= init_chipset_piix,	\
 		.init_hwif	= init_hwif_piix,	\
 		.channels	= 2,			\
@@ -32,7 +30,6 @@

 	{	/* 2 */
 		.name		= "MPIIX",
-		.init_setup	= init_setup_piix,
 		.init_hwif	= init_hwif_piix,
 		.channels	= 2,
 		.autodma	= NODMA,
diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
--- a/drivers/ide/pci/sgiioc4.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/pci/sgiioc4.c	2005-02-03 17:02:35 +01:00
@@ -669,7 +669,8 @@
 		printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n",
 		       hwif->name, d->name);

-	probe_hwif_init(hwif);
+	if (probe_hwif_init(hwif))
+		return -EIO;

 	/* Create /proc/ide entries */
 	create_proc_ide_interfaces();
diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
--- a/drivers/ide/pci/siimage.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/ide/pci/siimage.c	2005-02-03 17:02:35 +01:00
@@ -590,7 +590,7 @@
 		if ((hwif->INL(SATA_STATUS_REG) & 0x03) != 0x03) {
 			printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
 				hwif->name, hwif->INL(SATA_STATUS_REG));
-			HWGROUP(drive)->poll_timeout = 0;
+			HWGROUP(drive)->polling = 0;
 			return ide_started;
 		}
 		return 0;
diff -Nru a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
--- a/drivers/scsi/ide-scsi.c	2005-02-03 17:02:35 +01:00
+++ b/drivers/scsi/ide-scsi.c	2005-02-03 17:02:35 +01:00
@@ -152,7 +152,7 @@
 		}
 		count = min(pc->sg->length - pc->b_count, bcount);
 		buf = page_address(pc->sg->page) + pc->sg->offset;
-		atapi_input_bytes (drive, buf + pc->b_count, count);
+		drive->hwif->atapi_input_bytes(drive, buf + pc->b_count, count);
 		bcount -= count; pc->b_count += count;
 		if (pc->b_count == pc->sg->length) {
 			pc->sg++;
@@ -174,7 +174,7 @@
 		}
 		count = min(pc->sg->length - pc->b_count, bcount);
 		buf = page_address(pc->sg->page) + pc->sg->offset;
-		atapi_output_bytes (drive, buf + pc->b_count, count);
+		drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count);
 		bcount -= count; pc->b_count += count;
 		if (pc->b_count == pc->sg->length) {
 			pc->sg++;
@@ -481,7 +481,7 @@
 					if (pc->sg)
 						idescsi_input_buffers(drive, pc, temp);
 					else
-						atapi_input_bytes(drive, pc->current_position, temp);
+						drive->hwif->atapi_input_bytes(drive, pc->current_position, temp);
 					printk(KERN_ERR "ide-scsi: transferred %d of %d bytes\n", temp, bcount.all);
 				}
 				pc->actually_transferred += temp;
@@ -541,7 +541,7 @@
 	/* Set the interrupt routine */
 	ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
 	/* Send the actual packet */
-	atapi_output_bytes(drive, scsi->pc->c, 12);
+	drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12);
 	if (test_bit (PC_DMA_OK, &pc->flags)) {
 		set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
 		hwif->dma_start(drive);
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2005-02-03 17:02:35 +01:00
+++ b/include/linux/ide.h	2005-02-03 17:02:35 +01:00
@@ -187,11 +187,7 @@
  * Timeouts for various operations:
  */
 #define WAIT_DRQ	(HZ/10)		/* 100msec - spec allows up to 20ms */
-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
 #define WAIT_READY	(5*HZ)		/* 5sec - some laptops are very slow */
-#else
-#define WAIT_READY	(HZ/10)		/* 100msec - should be instantaneous */
-#endif /* CONFIG_APM || CONFIG_APM_MODULE */
 #define WAIT_PIDENTIFY	(10*HZ)	/* 10sec  - should be less than 3ms (?), if all ATAPI CD is closed at boot */
 #define WAIT_WORSTCASE	(30*HZ)	/* 30sec  - worst case when spinning up */
 #define WAIT_CMD	(10*HZ)	/* 10sec  - maximum wait for an IRQ to happen */
@@ -721,6 +717,7 @@
 					 *  3=64-bit
 					 */
 	unsigned scsi		: 1;	/* 0=default, 1=ide-scsi emulation */
+	unsigned sleeping	: 1;	/* 1=sleeping & sleep field valid */

         u8	quirk_list;	/* considered quirky, set for a specific host */
         u8	init_speed;	/* transfer rate set at boot */
@@ -937,7 +934,9 @@
 		/* BOOL: protects all fields below */
 	volatile int busy;
 		/* BOOL: wake us up on timer expiry */
-	int sleeping;
+	int sleeping	: 1;
+		/* BOOL: polling active & poll_timeout field valid */
+	int polling	: 1;
 		/* current drive */
 	ide_drive_t *drive;
 		/* ptr to current hwif in linked-list */
@@ -1297,11 +1296,6 @@
 extern void SELECT_MASK(ide_drive_t *, int);
 extern void QUIRK_LIST(ide_drive_t *);

-extern void ata_input_data(ide_drive_t *, void *, u32);
-extern void ata_output_data(ide_drive_t *, void *, u32);
-extern void atapi_input_bytes(ide_drive_t *, void *, u32);
-extern void atapi_output_bytes(ide_drive_t *, void *, u32);
-
 extern int drive_is_ready(ide_drive_t *);
 extern int wait_for_ready(ide_drive_t *, int /* timeout */);

@@ -1341,14 +1335,6 @@
 ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block);

 /*
- * ide_system_bus_speed() returns what we think is the system VESA/PCI
- * bus speed (in MHz).  This is used for calculating interface PIO timings.
- * The default is 40 for known PCI systems, 50 otherwise.
- * The "idebus=xx" parameter can be used to override this value.
- */
-extern int ide_system_bus_speed(void);
-
-/*
  * ide_stall_queue() can be used by a drive to give excess bandwidth back
  * to the hwgroup by sleeping for timeout jiffies.
  */
@@ -1361,7 +1347,6 @@
 extern void ide_init_subdrivers(void);

 extern struct block_device_operations ide_fops[];
-extern ide_proc_entry_t generic_subdriver_entries[];

 extern int ata_attach(ide_drive_t *);

@@ -1458,7 +1443,6 @@
 extern int ide_dma_setup(ide_drive_t *);
 extern void ide_dma_start(ide_drive_t *);
 extern int __ide_dma_end(ide_drive_t *);
-extern int __ide_dma_test_irq(ide_drive_t *);
 extern int __ide_dma_lostirq(ide_drive_t *);
 extern int __ide_dma_timeout(ide_drive_t *);
 #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2005-01-07  3:48 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-01-07  3:48 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi,

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/arm/icside.c   |    2
 drivers/ide/cris/ide-v10.c |    2
 drivers/ide/ide-cd.c       |   69 +---------------
 drivers/ide/ide-disk.c     |  190 ---------------------------------------------
 drivers/ide/ide-dma.c      |    3
 drivers/ide/ide-floppy.c   |    4
 drivers/ide/ide-io.c       |  169 +++++++++++++++++++++++-----------------
 drivers/ide/ide-iops.c     |    4
 drivers/ide/ide-lib.c      |  132 ++++++++++++++++++++++++++++++-
 drivers/ide/ide-taskfile.c |    8 -
 drivers/ide/ide.c          |  151 +----------------------------------
 drivers/ide/pci/sgiioc4.c  |    8 -
 drivers/ide/ppc/pmac.c     |    2
 drivers/ide/setup-pci.c    |   27 +-----
 drivers/pci/quirks.c       |   20 ++++
 drivers/scsi/ide-scsi.c    |   33 -------
 include/linux/ide.h        |   22 +----
 17 files changed, 293 insertions(+), 553 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (05/01/07 1.2241)
   [ide] kill current_capacity()

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2240)
   [ide] ide_driver_t->abort() cleanup

   * add drive->media != ide_disk check to ide_abort()
   * kill ide_cdrom_abort() and idedisk_abort()
   * split __ide_abort() out of ide_abort()
   * call driver->abort() inside ide_abort()
   * convert the only user of driver->abort()
   * fix default_abort() and idescsi_atapi_abort()
   * make idescsi_atapi_abort() static

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2239)
   [ide] rework ide_driver_t->error

   * split __ide_error() out of ide_error()
   * call driver->error() inside ide_error()
   * convert all users of driver->error()
   * fix default_cleanup() and idescsi_atapi_error()
   * make idescsi_atapi_error() static

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2238)
   [ide] cleanup ide_error()

   * move idedisk_error() and ide_cdrom_error() to ide-io.c
   * rename idedisk_error() to ide_ata_error()
   * rename ide_cdrom_error() to ide_atapi_error()
   * use ide_{ata,atapi}_error() in ide_error()

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2237)
   [ide] cleanup ide_dump_status()

   * move idedisk_dump_status() and ide_dump_status() to ide-lib.c
   * rename idedisk_dump_status() to ide_dump_ata_status()
   * use ide_dump_{ata,atapi}_status() in ide_dump_status()
   * use ide_dump_status() in ide-cd.c, ide-disk.c and ide-scsi.c
   * make ide_dump_opcode() and ide_dump_atapi_status)() static

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2236)
   [ide] add ide_dump_opcode()

   * add it to ide-lib.c and cleanup ide{disk}_dump_status()
   * as a bonus it fixes unknown opcode reporting in ide_dump_status()
   * use ide_dump_opcode() in ide_dump_atapi_status()

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2235)
   [ide] kill write-only ide_driver_t->sense

   also kill default_sense() in ide.c

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2234)
   [ide] PCI quirk for ICH3-M IDE

   From: Jim Paris <jim@jtan.com>

   Bartlomiej: I have an ICH3-M controller on my laptop.  The BIOS is
   leaving the prog-if as 0x8E (primary = legacy, secondary = native).
   When the PCI interrupt is routed (either in the IDE driver's
   pci_enable_device, or earlier if pci=routeirq is used), unhandled
   interrupts cause IRQ 9 to be disabled, breaking most of my other
   hardware.  This seems to be caused by having the nonexistant secondary
   interface set to native mode.  According to the datasheet I checked,
   having different modes for primary/secondary is not an allowed
   combination anyway, so the following PCI quirk checks for this case
   and forces both interfaces to legacy if true.

   It may make sense to make this more generic (this problem may affect
   other PCI IDs as well), or it may be better solved in the IDE driver,
   at least when pci=routeirq is not used.  But the following patch does
   work well for me.

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2233)
   [ide] fix erroneous rq->buffer = NULL in ide-io.c:ide_dma_timeout_retry()

   From: Prarit Bhargava <prarit@sgi.com>

   Please see discussion related to this patch here,

   http://marc.theaimsgroup.com/?l=linux-ide&m=110485007824374&w=2

   Acked-by: Jens Axboe <axboe@suse.de>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2232)
   [ide] disable debug in IDE ppc/pmac driver

   Ben did not disagree to hide the 3 additional lines printed when booting
   my ibook with the 'quiet' cmdline option.
   I think these debug printk have no real value for normal operation.

   Signed-off-by: Olaf Hering <olh@suse.de>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2231)
   [ide] remove CRD-8480C from the DMA blacklist

   Reported to work OK by Daniel Robitaille <robitaille@gmail.com>.

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (05/01/07 1.2230)
   [ide] remove pci_disable_device() calls from setup-pci.c and sgiioc4.c

   On Mon, 03 Jan 2005 21:44:33 +0000, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
   >
   > Different PCI functions are but nothing requires that the PCI function
   > that is the IDE controller is only the IDE controller. In some cases
   > other logic lives in the "spare" BAR register areas of the device.
   >
   > One example where the weird design makes it obvious is the CS5520. Here
   > the 5520 bridge has the IDE in one BAR and all sorts of other logic
   > (including the xBUS virtual ISA environment) in the same PCI function.
   > On that chip a pci_disable_device on the IDE pci_dev turns off mundane
   > things like the timer chips keyboard and mouse 8).
   >
   > Other vendors do equally evil things and providing the chip reports IDE
   > class and has the IDE BARs set up nobody else is any the wiser and
   > presumably gate count goes down.

   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
--- a/drivers/ide/arm/icside.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/arm/icside.c	2005-01-07 04:16:03 +01:00
@@ -423,7 +423,7 @@
 		       drive->name, dma_stat);
 	}

-	return DRIVER(drive)->error(drive, __FUNCTION__, stat);
+	return ide_error(drive, __FUNCTION__, stat);
 }

 static int icside_dma_setup(ide_drive_t *drive)
diff -Nru a/drivers/ide/cris/ide-v10.c b/drivers/ide/cris/ide-v10.c
--- a/drivers/ide/cris/ide-v10.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/cris/ide-v10.c	2005-01-07 04:16:03 +01:00
@@ -773,7 +773,7 @@
 		}
 		printk("%s: bad DMA status\n", drive->name);
 	}
-	return DRIVER(drive)->error(drive, "dma_intr", stat);
+	return ide_error(drive, "dma_intr", stat);
 }

 /*
diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide-cd.c	2005-01-07 04:16:03 +01:00
@@ -559,62 +559,6 @@
 	(void) ide_do_drive_cmd(drive, rq, ide_preempt);
 }

-/*
- * ide_error() takes action based on the error returned by the drive.
- */
-static ide_startstop_t ide_cdrom_error (ide_drive_t *drive, const char *msg, byte stat)
-{
-	struct request *rq;
-	byte err;
-
-	err = ide_dump_atapi_status(drive, msg, stat);
-	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
-		return ide_stopped;
-	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
-		rq->errors = 1;
-		ide_end_drive_cmd(drive, stat, err);
-		return ide_stopped;
-	}
-
-	if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
-		/* other bits are useless when BUSY */
-		rq->errors |= ERROR_RESET;
-	} else {
-		/* add decoding error stuff */
-	}
-	if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
-		/* force an abort */
-		HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
-	if (rq->errors >= ERROR_MAX) {
-		DRIVER(drive)->end_request(drive, 0, 0);
-	} else {
-		if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
-			++rq->errors;
-			return ide_do_reset(drive);
-		}
-		++rq->errors;
-	}
-	return ide_stopped;
-}
-
-static ide_startstop_t ide_cdrom_abort (ide_drive_t *drive, const char *msg)
-{
-	struct request *rq;
-
-	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
-		return ide_stopped;
-	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
-		rq->errors = 1;
-		ide_end_drive_cmd(drive, BUSY_STAT, 0);
-		return ide_stopped;
-	}
-	rq->errors |= ERROR_RESET;
-	DRIVER(drive)->end_request(drive, 0, 0);
-	return ide_stopped;
-}
-
 static void cdrom_end_request (ide_drive_t *drive, int uptodate)
 {
 	struct request *rq = HWGROUP(drive)->rq;
@@ -690,7 +634,7 @@

 		rq->flags |= REQ_FAILED;
 		cdrom_end_request(drive, 0);
-		DRIVER(drive)->error(drive, "request sense failure", stat);
+		ide_error(drive, "request sense failure", stat);
 		return 1;

 	} else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) {
@@ -801,7 +745,7 @@
 		} else if ((err & ~ABRT_ERR) != 0) {
 			/* Go to the default handler
 			   for other errors. */
-			DRIVER(drive)->error(drive, "cdrom_decode_status",stat);
+			ide_error(drive, "cdrom_decode_status", stat);
 			return 1;
 		} else if ((++rq->errors > ERROR_MAX)) {
 			/* We've racked up too many retries.  Abort. */
@@ -1070,7 +1014,7 @@
 			ide_end_request(drive, 1, rq->nr_sectors);
 			return ide_stopped;
 		} else
-			return DRIVER(drive)->error(drive, "dma error", stat);
+			return ide_error(drive, "dma error", stat);
 	}

 	/* Read the interrupt reason and the transfer length. */
@@ -1673,7 +1617,7 @@
 		if (dma_error) {
 			printk("ide-cd: dma error\n");
 			__ide_dma_off(drive);
-			return DRIVER(drive)->error(drive, "dma error", stat);
+			return ide_error(drive, "dma error", stat);
 		}

 		end_that_request_chunk(rq, 1, rq->data_len);
@@ -1811,7 +1755,7 @@
 	 */
 	if (dma) {
 		if (dma_error)
-			return DRIVER(drive)->error(drive, "dma error", stat);
+			return ide_error(drive, "dma error", stat);

 		ide_end_request(drive, 1, rq->nr_sectors);
 		return ide_stopped;
@@ -3369,9 +3313,6 @@
 	.supports_dsc_overlap	= 1,
 	.cleanup		= ide_cdrom_cleanup,
 	.do_request		= ide_do_rw_cdrom,
-	.sense			= ide_dump_atapi_status,
-	.error			= ide_cdrom_error,
-	.abort			= ide_cdrom_abort,
 	.capacity		= ide_cdrom_capacity,
 	.attach			= ide_cdrom_attach,
 	.drives			= LIST_HEAD_INIT(ide_cdrom_driver.drives),
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide-disk.c	2005-01-07 04:16:03 +01:00
@@ -287,189 +287,6 @@
 		return __ide_do_rw_disk(drive, rq, block);
 }

-static u8 idedisk_dump_status (ide_drive_t *drive, const char *msg, u8 stat)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	unsigned long flags;
-	u8 err = 0;
-
-	local_irq_set(flags);
-	printk("%s: %s: status=0x%02x", drive->name, msg, stat);
-	printk(" { ");
-	if (stat & BUSY_STAT)
-		printk("Busy ");
-	else {
-		if (stat & READY_STAT)	printk("DriveReady ");
-		if (stat & WRERR_STAT)	printk("DeviceFault ");
-		if (stat & SEEK_STAT)	printk("SeekComplete ");
-		if (stat & DRQ_STAT)	printk("DataRequest ");
-		if (stat & ECC_STAT)	printk("CorrectedError ");
-		if (stat & INDEX_STAT)	printk("Index ");
-		if (stat & ERR_STAT)	printk("Error ");
-	}
-	printk("}");
-	printk("\n");
-	if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
-		err = hwif->INB(IDE_ERROR_REG);
-		printk("%s: %s: error=0x%02x", drive->name, msg, err);
-		printk(" { ");
-		if (err & ABRT_ERR)	printk("DriveStatusError ");
-		if (err & ICRC_ERR)
-			printk("Bad%s ", (err & ABRT_ERR) ? "CRC" : "Sector");
-		if (err & ECC_ERR)	printk("UncorrectableError ");
-		if (err & ID_ERR)	printk("SectorIdNotFound ");
-		if (err & TRK0_ERR)	printk("TrackZeroNotFound ");
-		if (err & MARK_ERR)	printk("AddrMarkNotFound ");
-		printk("}");
-		if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR ||
-		    (err & (ECC_ERR|ID_ERR|MARK_ERR))) {
-			if (drive->addressing == 1) {
-				__u64 sectors = 0;
-				u32 low = 0, high = 0;
-				low = ide_read_24(drive);
-				hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
-				high = ide_read_24(drive);
-				sectors = ((__u64)high << 24) | low;
-				printk(", LBAsect=%llu, high=%d, low=%d",
-				       (unsigned long long) sectors,
-				       high, low);
-			} else {
-				u8 cur = hwif->INB(IDE_SELECT_REG);
-				if (cur & 0x40) {	/* using LBA? */
-					printk(", LBAsect=%ld", (unsigned long)
-					 ((cur&0xf)<<24)
-					 |(hwif->INB(IDE_HCYL_REG)<<16)
-					 |(hwif->INB(IDE_LCYL_REG)<<8)
-					 | hwif->INB(IDE_SECTOR_REG));
-				} else {
-					printk(", CHS=%d/%d/%d",
-					 (hwif->INB(IDE_HCYL_REG)<<8) +
-					  hwif->INB(IDE_LCYL_REG),
-					  cur & 0xf,
-					  hwif->INB(IDE_SECTOR_REG));
-				}
-			}
-			if (HWGROUP(drive) && HWGROUP(drive)->rq)
-				printk(", sector=%llu",
-					(unsigned long long)HWGROUP(drive)->rq->sector);
-		}
-	}
-	printk("\n");
-	{
-		struct request *rq;
-		unsigned char opcode = 0;
-		int found = 0;
-
-		spin_lock(&ide_lock);
-		rq = HWGROUP(drive)->rq;
-		spin_unlock(&ide_lock);
-		if (!rq)
-			goto out;
-		if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
-			char *args = rq->buffer;
-			if (args) {
-				opcode = args[0];
-				found = 1;
-			}
-		} else if (rq->flags & REQ_DRIVE_TASKFILE) {
-			ide_task_t *args = rq->special;
-			if (args) {
-				task_struct_t *tf = (task_struct_t *) args->tfRegister;
-				opcode = tf->command;
-				found = 1;
-			}
-		}
-		printk("ide: failed opcode was: ");
-		if (!found)
-			printk("unknown\n");
-		else
-			printk("0x%02x\n", opcode);
-	}
-out:
-	local_irq_restore(flags);
-	return err;
-}
-
-static ide_startstop_t idedisk_error (ide_drive_t *drive, const char *msg, u8 stat)
-{
-	ide_hwif_t *hwif;
-	struct request *rq;
-	u8 err;
-
-	err = idedisk_dump_status(drive, msg, stat);
-
-	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
-		return ide_stopped;
-
-	hwif = HWIF(drive);
-	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
-		rq->errors = 1;
-		ide_end_drive_cmd(drive, stat, err);
-		return ide_stopped;
-	}
-
-	if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
-		/* other bits are useless when BUSY */
-		rq->errors |= ERROR_RESET;
-	} else if (stat & ERR_STAT) {
-		/* err has different meaning on cdrom and tape */
-		if (err == ABRT_ERR) {
-			if (drive->select.b.lba &&
-			    /* some newer drives don't support WIN_SPECIFY */
-			    hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY)
-				return ide_stopped;
-		} else if ((err & BAD_CRC) == BAD_CRC) {
-			/* UDMA crc error, just retry the operation */
-			drive->crc_count++;
-		} else if (err & (BBD_ERR | ECC_ERR)) {
-			/* retries won't help these */
-			rq->errors = ERROR_MAX;
-		} else if (err & TRK0_ERR) {
-			/* help it find track zero */
-			rq->errors |= ERROR_RECAL;
-		}
-	}
-	if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)
-		try_to_flush_leftover_data(drive);
-	if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
-		/* force an abort */
-		hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
-	}
-	if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
-		DRIVER(drive)->end_request(drive, 0, 0);
-	else {
-		if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
-			++rq->errors;
-			return ide_do_reset(drive);
-		}
-		if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
-			drive->special.b.recalibrate = 1;
-		++rq->errors;
-	}
-	return ide_stopped;
-}
-
-static ide_startstop_t idedisk_abort(ide_drive_t *drive, const char *msg)
-{
-	ide_hwif_t *hwif;
-	struct request *rq;
-
-	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
-		return ide_stopped;
-
-	hwif = HWIF(drive);
-
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
-		rq->errors = 1;
-		ide_end_drive_cmd(drive, BUSY_STAT, 0);
-		return ide_stopped;
-	}
-
-	DRIVER(drive)->end_request(drive, 0, 0);
-	return ide_stopped;
-}
-
 /*
  * Queries for true maximum capacity of the drive.
  * Returns maximum LBA address (> 0) of the drive, 0 if failed.
@@ -1358,9 +1175,6 @@
 	.supports_dsc_overlap	= 0,
 	.cleanup		= idedisk_cleanup,
 	.do_request		= ide_do_rw_disk,
-	.sense			= idedisk_dump_status,
-	.error			= idedisk_error,
-	.abort			= idedisk_abort,
 	.pre_reset		= idedisk_pre_reset,
 	.capacity		= idedisk_capacity,
 	.special		= idedisk_special,
@@ -1434,7 +1248,7 @@
 static int idedisk_revalidate_disk(struct gendisk *disk)
 {
 	ide_drive_t *drive = disk->private_data;
-	set_capacity(disk, current_capacity(drive));
+	set_capacity(disk, idedisk_capacity(drive));
 	return 0;
 }

@@ -1478,7 +1292,7 @@
 	strcpy(g->devfs_name, drive->devfs_name);
 	g->driverfs_dev = &drive->gendev;
 	g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
-	set_capacity(g, current_capacity(drive));
+	set_capacity(g, idedisk_capacity(drive));
 	g->fops = &idedisk_ops;
 	add_disk(g);
 	return 0;
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide-dma.c	2005-01-07 04:16:03 +01:00
@@ -116,7 +116,6 @@
 	{ "Compaq CRD-8241B"	,	"ALL"		},
 	{ "CRD-8400B"		,	"ALL"		},
 	{ "CRD-8480B",			"ALL"		},
-	{ "CRD-8480C",			"ALL"		},
 	{ "CRD-8482B",			"ALL"		},
  	{ "CRD-84"		,	"ALL"		},
 	{ "SanDisk SDP3B"	,	"ALL"		},
@@ -184,7 +183,7 @@
 		printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
 		       drive->name, dma_stat);
 	}
-	return DRIVER(drive)->error(drive, "dma_intr", stat);
+	return ide_error(drive, "dma_intr", stat);
 }

 EXPORT_SYMBOL_GPL(ide_dma_intr);
diff -Nru a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
--- a/drivers/ide/ide-floppy.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide-floppy.c	2005-01-07 04:16:03 +01:00
@@ -1640,7 +1640,7 @@
 }

 /*
- *	Return the current floppy capacity to ide.c.
+ *	Return the current floppy capacity.
  */
 static sector_t idefloppy_capacity (ide_drive_t *drive)
 {
@@ -2034,7 +2034,7 @@
 static int idefloppy_revalidate_disk(struct gendisk *disk)
 {
 	ide_drive_t *drive = disk->private_data;
-	set_capacity(disk, current_capacity(drive));
+	set_capacity(disk, idefloppy_capacity(drive));
 	return 0;
 }

diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide-io.c	2005-01-07 04:16:03 +01:00
@@ -454,9 +454,88 @@

 EXPORT_SYMBOL(try_to_flush_leftover_data);

-/*
- * FIXME Add an ATAPI error
- */
+static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
+{
+	ide_hwif_t *hwif = drive->hwif;
+
+	if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
+		/* other bits are useless when BUSY */
+		rq->errors |= ERROR_RESET;
+	} else if (stat & ERR_STAT) {
+		/* err has different meaning on cdrom and tape */
+		if (err == ABRT_ERR) {
+			if (drive->select.b.lba &&
+			    /* some newer drives don't support WIN_SPECIFY */
+			    hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY)
+				return ide_stopped;
+		} else if ((err & BAD_CRC) == BAD_CRC) {
+			/* UDMA crc error, just retry the operation */
+			drive->crc_count++;
+		} else if (err & (BBD_ERR | ECC_ERR)) {
+			/* retries won't help these */
+			rq->errors = ERROR_MAX;
+		} else if (err & TRK0_ERR) {
+			/* help it find track zero */
+			rq->errors |= ERROR_RECAL;
+		}
+	}
+
+	if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)
+		try_to_flush_leftover_data(drive);
+
+	if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
+		/* force an abort */
+		hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
+
+	if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
+		drive->driver->end_request(drive, 0, 0);
+	else {
+		if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
+			++rq->errors;
+			return ide_do_reset(drive);
+		}
+		if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
+			drive->special.b.recalibrate = 1;
+		++rq->errors;
+	}
+	return ide_stopped;
+}
+
+static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
+{
+	ide_hwif_t *hwif = drive->hwif;
+
+	if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
+		/* other bits are useless when BUSY */
+		rq->errors |= ERROR_RESET;
+	} else {
+		/* add decoding error stuff */
+	}
+
+	if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
+		/* force an abort */
+		hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
+
+	if (rq->errors >= ERROR_MAX) {
+		drive->driver->end_request(drive, 0, 0);
+	} else {
+		if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
+			++rq->errors;
+			return ide_do_reset(drive);
+		}
+		++rq->errors;
+	}
+
+	return ide_stopped;
+}
+
+ide_startstop_t
+__ide_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
+{
+	if (drive->media == ide_disk)
+		return ide_ata_error(drive, rq, stat, err);
+	return ide_atapi_error(drive, rq, stat, err);
+}

 /**
  *	ide_error	-	handle an error on the IDE
@@ -473,73 +552,32 @@

 ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, u8 stat)
 {
-	ide_hwif_t *hwif;
 	struct request *rq;
 	u8 err;

 	err = ide_dump_status(drive, msg, stat);
+
 	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
 		return ide_stopped;

-	hwif = HWIF(drive);
 	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
-		rq->errors = 1;
-		ide_end_drive_cmd(drive, stat, err);
-		return ide_stopped;
-	}
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
+	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
 		rq->errors = 1;
 		ide_end_drive_cmd(drive, stat, err);
 		return ide_stopped;
 	}

-	if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
-		 /* other bits are useless when BUSY */
+	return drive->driver->error(drive, rq, stat, err);
+}
+
+EXPORT_SYMBOL_GPL(ide_error);
+
+ide_startstop_t __ide_abort(ide_drive_t *drive, struct request *rq)
+{
+	if (drive->media != ide_disk)
 		rq->errors |= ERROR_RESET;
-	} else {
-		if (drive->media != ide_disk)
-			goto media_out;

-		if (stat & ERR_STAT) {
-			/* err has different meaning on cdrom and tape */
-			if (err == ABRT_ERR) {
-				if (drive->select.b.lba &&
-				    (hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY))
-					/* some newer drives don't
-					 * support WIN_SPECIFY
-					 */
-					return ide_stopped;
-			} else if ((err & BAD_CRC) == BAD_CRC) {
-				drive->crc_count++;
-				/* UDMA crc error -- just retry the operation */
-			} else if (err & (BBD_ERR | ECC_ERR)) {
-				/* retries won't help these */
-				rq->errors = ERROR_MAX;
-			} else if (err & TRK0_ERR) {
-				/* help it find track zero */
-				rq->errors |= ERROR_RECAL;
-			}
-		}
-media_out:
-		if ((stat & DRQ_STAT) && rq_data_dir(rq) != WRITE)
-			try_to_flush_leftover_data(drive);
-	}
-	if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
-		/* force an abort */
-		hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
-	}
-	if (rq->errors >= ERROR_MAX) {
-		DRIVER(drive)->end_request(drive, 0, 0);
-	} else {
-		if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
-			++rq->errors;
-			return ide_do_reset(drive);
-		}
-		if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
-			drive->special.b.recalibrate = 1;
-		++rq->errors;
-	}
+	DRIVER(drive)->end_request(drive, 0, 0);
 	return ide_stopped;
 }

@@ -559,28 +597,19 @@

 ide_startstop_t ide_abort(ide_drive_t *drive, const char *msg)
 {
-	ide_hwif_t *hwif;
 	struct request *rq;

 	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
 		return ide_stopped;

-	hwif = HWIF(drive);
 	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
-		rq->errors = 1;
-		ide_end_drive_cmd(drive, BUSY_STAT, 0);
-		return ide_stopped;
-	}
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
+	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
 		rq->errors = 1;
 		ide_end_drive_cmd(drive, BUSY_STAT, 0);
 		return ide_stopped;
 	}

-	rq->errors |= ERROR_RESET;
-	DRIVER(drive)->end_request(drive, 0, 0);
-	return ide_stopped;
+	return drive->driver->abort(drive, rq);
 }

 /**
@@ -634,7 +663,7 @@
 	}

 	if (!OK_STAT(stat, READY_STAT, BAD_STAT) && DRIVER(drive) != NULL)
-		return DRIVER(drive)->error(drive, "drive_cmd", stat);
+		return ide_error(drive, "drive_cmd", stat);
 		/* calls ide_end_drive_cmd */
 	ide_end_drive_cmd(drive, stat, hwif->INB(IDE_ERROR_REG));
 	return ide_stopped;
@@ -1181,7 +1210,7 @@
 	if (error < 0) {
 		printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
 		(void)HWIF(drive)->ide_dma_end(drive);
-		ret = DRIVER(drive)->error(drive, "dma timeout error",
+		ret = ide_error(drive, "dma timeout error",
 						hwif->INB(IDE_STATUS_REG));
 	} else {
 		printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
@@ -1212,7 +1241,7 @@
 	rq->sector = rq->bio->bi_sector;
 	rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9;
 	rq->hard_cur_sectors = rq->current_nr_sectors;
-	rq->buffer = NULL;
+	rq->buffer = bio_data(rq->bio);
 out:
 	return ret;
 }
@@ -1304,7 +1333,7 @@
 					startstop = ide_dma_timeout_retry(drive, wait);
 				} else
 					startstop =
-					DRIVER(drive)->error(drive, "irq timeout", hwif->INB(IDE_STATUS_REG));
+					ide_error(drive, "irq timeout", hwif->INB(IDE_STATUS_REG));
 			}
 			drive->service_time = jiffies - drive->service_start;
 			spin_lock_irq(&ide_lock);
diff -Nru a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
--- a/drivers/ide/ide-iops.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide-iops.c	2005-01-07 04:16:03 +01:00
@@ -576,7 +576,7 @@
 					break;

 				local_irq_restore(flags);
-				*startstop = DRIVER(drive)->error(drive, "status timeout", stat);
+				*startstop = ide_error(drive, "status timeout", stat);
 				return 1;
 			}
 		}
@@ -594,7 +594,7 @@
 		if (OK_STAT((stat = hwif->INB(IDE_STATUS_REG)), good, bad))
 			return 0;
 	}
-	*startstop = DRIVER(drive)->error(drive, "status error", stat);
+	*startstop = ide_error(drive, "status error", stat);
 	return 1;
 }

diff -Nru a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
--- a/drivers/ide/ide-lib.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide-lib.c	2005-01-07 04:16:03 +01:00
@@ -445,6 +445,114 @@

 EXPORT_SYMBOL_GPL(ide_set_xfer_rate);

+static void ide_dump_opcode(ide_drive_t *drive)
+{
+	struct request *rq;
+	u8 opcode = 0;
+	int found = 0;
+
+	spin_lock(&ide_lock);
+	rq = NULL;
+	if (HWGROUP(drive))
+		rq = HWGROUP(drive)->rq;
+	spin_unlock(&ide_lock);
+	if (!rq)
+		return;
+	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
+		char *args = rq->buffer;
+		if (args) {
+			opcode = args[0];
+			found = 1;
+		}
+	} else if (rq->flags & REQ_DRIVE_TASKFILE) {
+		ide_task_t *args = rq->special;
+		if (args) {
+			task_struct_t *tf = (task_struct_t *) args->tfRegister;
+			opcode = tf->command;
+			found = 1;
+		}
+	}
+
+	printk("ide: failed opcode was: ");
+	if (!found)
+		printk("unknown\n");
+	else
+		printk("0x%02x\n", opcode);
+}
+
+static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	unsigned long flags;
+	u8 err = 0;
+
+	local_irq_set(flags);
+	printk("%s: %s: status=0x%02x", drive->name, msg, stat);
+	printk(" { ");
+	if (stat & BUSY_STAT)
+		printk("Busy ");
+	else {
+		if (stat & READY_STAT)	printk("DriveReady ");
+		if (stat & WRERR_STAT)	printk("DeviceFault ");
+		if (stat & SEEK_STAT)	printk("SeekComplete ");
+		if (stat & DRQ_STAT)	printk("DataRequest ");
+		if (stat & ECC_STAT)	printk("CorrectedError ");
+		if (stat & INDEX_STAT)	printk("Index ");
+		if (stat & ERR_STAT)	printk("Error ");
+	}
+	printk("}");
+	printk("\n");
+	if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
+		err = hwif->INB(IDE_ERROR_REG);
+		printk("%s: %s: error=0x%02x", drive->name, msg, err);
+		printk(" { ");
+		if (err & ABRT_ERR)	printk("DriveStatusError ");
+		if (err & ICRC_ERR)
+			printk("Bad%s ", (err & ABRT_ERR) ? "CRC" : "Sector");
+		if (err & ECC_ERR)	printk("UncorrectableError ");
+		if (err & ID_ERR)	printk("SectorIdNotFound ");
+		if (err & TRK0_ERR)	printk("TrackZeroNotFound ");
+		if (err & MARK_ERR)	printk("AddrMarkNotFound ");
+		printk("}");
+		if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR ||
+		    (err & (ECC_ERR|ID_ERR|MARK_ERR))) {
+			if (drive->addressing == 1) {
+				__u64 sectors = 0;
+				u32 low = 0, high = 0;
+				low = ide_read_24(drive);
+				hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
+				high = ide_read_24(drive);
+				sectors = ((__u64)high << 24) | low;
+				printk(", LBAsect=%llu, high=%d, low=%d",
+				       (unsigned long long) sectors,
+				       high, low);
+			} else {
+				u8 cur = hwif->INB(IDE_SELECT_REG);
+				if (cur & 0x40) {	/* using LBA? */
+					printk(", LBAsect=%ld", (unsigned long)
+					 ((cur&0xf)<<24)
+					 |(hwif->INB(IDE_HCYL_REG)<<16)
+					 |(hwif->INB(IDE_LCYL_REG)<<8)
+					 | hwif->INB(IDE_SECTOR_REG));
+				} else {
+					printk(", CHS=%d/%d/%d",
+					 (hwif->INB(IDE_HCYL_REG)<<8) +
+					  hwif->INB(IDE_LCYL_REG),
+					  cur & 0xf,
+					  hwif->INB(IDE_SECTOR_REG));
+				}
+			}
+			if (HWGROUP(drive) && HWGROUP(drive)->rq)
+				printk(", sector=%llu",
+					(unsigned long long)HWGROUP(drive)->rq->sector);
+		}
+	}
+	printk("\n");
+	ide_dump_opcode(drive);
+	local_irq_restore(flags);
+	return err;
+}
+
 /**
  *	ide_dump_atapi_status       -       print human readable atapi status
  *	@drive: drive that status applies to
@@ -453,7 +561,8 @@
  *
  *	Error reporting, in human readable form (luxurious, but a memory hog).
  */
-byte ide_dump_atapi_status (ide_drive_t *drive, const char *msg, byte stat)
+
+static u8 ide_dump_atapi_status(ide_drive_t *drive, const char *msg, u8 stat)
 {
 	unsigned long flags;

@@ -488,8 +597,27 @@
 						error.b.sense_key);
 		printk("\n");
 	}
+	ide_dump_opcode(drive);
 	local_irq_restore(flags);
 	return error.all;
 }

-EXPORT_SYMBOL(ide_dump_atapi_status);
+/**
+ *	ide_dump_status		-	translate ATA/ATAPI error
+ *	@drive: drive the error occured on
+ *	@msg: information string
+ *	@stat: status byte
+ *
+ *	Error reporting, in human readable form (luxurious, but a memory hog).
+ *	Combines the drive name, message and status byte to provide a
+ *	user understandable explanation of the device error.
+ */
+
+u8 ide_dump_status(ide_drive_t *drive, const char *msg, u8 stat)
+{
+	if (drive->media == ide_disk)
+		return ide_dump_ata_status(drive, msg, stat);
+	return ide_dump_atapi_status(drive, msg, stat);
+}
+
+EXPORT_SYMBOL(ide_dump_status);
diff -Nru a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
--- a/drivers/ide/ide-taskfile.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide-taskfile.c	2005-01-07 04:16:03 +01:00
@@ -199,7 +199,7 @@
 		return ide_stopped;

 	if (stat & (ERR_STAT|DRQ_STAT))
-		return DRIVER(drive)->error(drive, "set_geometry_intr", stat);
+		return ide_error(drive, "set_geometry_intr", stat);

 	if (HWGROUP(drive)->handler != NULL)
 		BUG();
@@ -218,7 +218,7 @@
 	u8 stat;

 	if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG), READY_STAT, BAD_STAT))
-		return DRIVER(drive)->error(drive, "recal_intr", stat);
+		return ide_error(drive, "recal_intr", stat);
 	return ide_stopped;
 }

@@ -235,7 +235,7 @@

 	local_irq_enable();
 	if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),READY_STAT,BAD_STAT)) {
-		return DRIVER(drive)->error(drive, "task_no_data_intr", stat);
+		return ide_error(drive, "task_no_data_intr", stat);
 		/* calls ide_end_drive_cmd */
 	}
 	if (args)
@@ -363,7 +363,7 @@
 		if (sectors > 0)
 			drive->driver->end_request(drive, 1, sectors);
 	}
-	return drive->driver->error(drive, s, stat);
+	return ide_error(drive, s, stat);
 }

 static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ide.c	2005-01-07 04:16:03 +01:00
@@ -358,137 +358,6 @@
 	return system_bus_speed;
 }

-/**
- *	current_capacity	-	drive capacity
- *	@drive: drive to query
- *
- *	Return the current capacity (in sectors) of a drive according to
- *	its current geometry/LBA settings. Empty removables are reported
- *	as size zero.
- */
-
-sector_t current_capacity (ide_drive_t *drive)
-{
-	if (!drive->present)
-		return 0;
-	return DRIVER(drive)->capacity(drive);
-}
-
-EXPORT_SYMBOL(current_capacity);
-
-/**
- *	ide_dump_status		-	translate ATA error
- *	@drive: drive the error occured on
- *	@msg: information string
- *	@stat: status byte
- *
- *	Error reporting, in human readable form (luxurious, but a memory hog).
- *	Combines the drive name, message and status byte to provide a
- *	user understandable explanation of the device error.
- */
-
-u8 ide_dump_status (ide_drive_t *drive, const char *msg, u8 stat)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	unsigned long flags;
-	u8 err = 0;
-
-	local_irq_set(flags);
-	printk(KERN_WARNING "%s: %s: status=0x%02x", drive->name, msg, stat);
-	printk(" { ");
-	if (stat & BUSY_STAT) {
-		printk("Busy ");
-	} else {
-		if (stat & READY_STAT)	printk("DriveReady ");
-		if (stat & WRERR_STAT)	printk("DeviceFault ");
-		if (stat & SEEK_STAT)	printk("SeekComplete ");
-		if (stat & DRQ_STAT)	printk("DataRequest ");
-		if (stat & ECC_STAT)	printk("CorrectedError ");
-		if (stat & INDEX_STAT)	printk("Index ");
-		if (stat & ERR_STAT)	printk("Error ");
-	}
-	printk("}");
-	printk("\n");
-	if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
-		err = hwif->INB(IDE_ERROR_REG);
-		printk("%s: %s: error=0x%02x", drive->name, msg, err);
-		if (drive->media == ide_disk) {
-			printk(" { ");
-			if (err & ABRT_ERR)	printk("DriveStatusError ");
-			if (err & ICRC_ERR)	printk("Bad%s ", (err & ABRT_ERR) ? "CRC" : "Sector");
-			if (err & ECC_ERR)	printk("UncorrectableError ");
-			if (err & ID_ERR)	printk("SectorIdNotFound ");
-			if (err & TRK0_ERR)	printk("TrackZeroNotFound ");
-			if (err & MARK_ERR)	printk("AddrMarkNotFound ");
-			printk("}");
-			if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR || (err & (ECC_ERR|ID_ERR|MARK_ERR))) {
-				if ((drive->id->command_set_2 & 0x0400) &&
-				    (drive->id->cfs_enable_2 & 0x0400) &&
-				    (drive->addressing == 1)) {
-					u64 sectors = 0;
-					u32 high = 0;
-					u32 low = ide_read_24(drive);
-					hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
-					high = ide_read_24(drive);
-
-					sectors = ((u64)high << 24) | low;
-					printk(", LBAsect=%llu, high=%d, low=%d",
-					       (long long) sectors,
-					       high, low);
-				} else {
-					u8 cur = hwif->INB(IDE_SELECT_REG);
-					if (cur & 0x40) {	/* using LBA? */
-						printk(", LBAsect=%ld", (unsigned long)
-						 ((cur&0xf)<<24)
-						 |(hwif->INB(IDE_HCYL_REG)<<16)
-						 |(hwif->INB(IDE_LCYL_REG)<<8)
-						 | hwif->INB(IDE_SECTOR_REG));
-					} else {
-						printk(", CHS=%d/%d/%d",
-						 (hwif->INB(IDE_HCYL_REG)<<8) +
-						  hwif->INB(IDE_LCYL_REG),
-						  cur & 0xf,
-						  hwif->INB(IDE_SECTOR_REG));
-					}
-				}
-				if (HWGROUP(drive) && HWGROUP(drive)->rq)
-					printk(", sector=%llu", (unsigned long long)HWGROUP(drive)->rq->sector);
-			}
-		}
-		printk("\n");
-	}
-	{
-		struct request *rq;
-		int opcode = 0x100;
-
-		spin_lock(&ide_lock);
-		rq = NULL;
-		if (HWGROUP(drive))
-			rq = HWGROUP(drive)->rq;
-		spin_unlock(&ide_lock);
-		if (!rq)
-			goto out;
-		if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
-			char *args = rq->buffer;
-			if (args)
-				opcode = args[0];
-		} else if (rq->flags & REQ_DRIVE_TASKFILE) {
-			ide_task_t *args = rq->special;
-			if (args) {
-				task_struct_t *tf = (task_struct_t *) args->tfRegister;
-				opcode = tf->command;
-			}
-		}
-
-		printk("ide: failed opcode was %x\n", opcode);
-	}
-out:
-	local_irq_restore(flags);
-	return err;
-}
-
-EXPORT_SYMBOL(ide_dump_status);
-
 static int ide_open (struct inode * inode, struct file * filp)
 {
 	return -ENXIO;
@@ -1673,8 +1542,9 @@
 			 */

 			spin_lock_irqsave(&ide_lock, flags);
-
-			DRIVER(drive)->abort(drive, "drive reset");
+
+			ide_abort(drive, "drive reset");
+
 			if(HWGROUP(drive)->handler)
 				BUG();

@@ -2180,14 +2050,10 @@
 	return ide_end_request(drive, uptodate, nr_sects);
 }

-static u8 default_sense (ide_drive_t *drive, const char *msg, u8 stat)
-{
-	return ide_dump_status(drive, msg, stat);
-}
-
-static ide_startstop_t default_error (ide_drive_t *drive, const char *msg, u8 stat)
+static ide_startstop_t
+default_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
 {
-	return ide_error(drive, msg, stat);
+	return __ide_error(drive, rq, stat, err);
 }

 static void default_pre_reset (ide_drive_t *drive)
@@ -2216,9 +2082,9 @@
 	return 0;
 }

-static ide_startstop_t default_abort (ide_drive_t *drive, const char *msg)
+static ide_startstop_t default_abort(ide_drive_t *drive, struct request *rq)
 {
-	return ide_abort(drive, msg);
+	return __ide_abort(drive, rq);
 }

 static ide_startstop_t default_start_power_step(ide_drive_t *drive,
@@ -2233,7 +2099,6 @@
 	if (d->cleanup == NULL)		d->cleanup = default_cleanup;
 	if (d->do_request == NULL)	d->do_request = default_do_request;
 	if (d->end_request == NULL)	d->end_request = default_end_request;
-	if (d->sense == NULL)		d->sense = default_sense;
 	if (d->error == NULL)		d->error = default_error;
 	if (d->abort == NULL)		d->abort = default_abort;
 	if (d->pre_reset == NULL)	d->pre_reset = default_pre_reset;
diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
--- a/drivers/ide/pci/sgiioc4.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/pci/sgiioc4.c	2005-01-07 04:16:03 +01:00
@@ -701,17 +701,11 @@
 			"firmware is obsolete - please upgrade to revision"
 			"46 or higher\n", d->name, dev->slot_name);
 		ret = -EAGAIN;
-		goto err_disable;
+		goto out;
 	}
 	ret = sgiioc4_ide_setup_pci_device(dev, d);
-	if (ret < 0)
-		goto err_disable;
 out:
 	return ret;
-
-err_disable:
-	pci_disable_device(dev);
-	goto out;
 }

 static ide_pci_device_t sgiioc4_chipsets[] __devinitdata = {
diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
--- a/drivers/ide/ppc/pmac.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/ppc/pmac.c	2005-01-07 04:16:03 +01:00
@@ -52,7 +52,7 @@

 #include "ide-timing.h"

-#define IDE_PMAC_DEBUG
+#undef IDE_PMAC_DEBUG

 #define DMA_WAIT_TIMEOUT	50

diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
--- a/drivers/ide/setup-pci.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/ide/setup-pci.c	2005-01-07 04:16:03 +01:00
@@ -311,13 +311,11 @@
 	ret = pci_set_dma_mask(dev, DMA_32BIT_MASK);
 	if (ret < 0) {
 		printk(KERN_ERR "%s: can't set dma mask\n", d->name);
-		pci_disable_device(dev);
 		goto out;
 	}

 	/* FIXME: Temporary - until we put in the hotplug interface logic
-	   Check that the bits we want are not in use by someone else.
-	   As someone else uses it, we do not (yuck) disable the device */
+	   Check that the bits we want are not in use by someone else. */
 	ret = pci_request_region(dev, 4, "ide_tmp");
 	if (ret < 0)
 		goto out;
@@ -542,12 +540,12 @@
 	ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
 	if (ret < 0) {
 		printk(KERN_ERR "%s: error accessing PCI regs\n", d->name);
-		goto err_disable;
+		goto out;
 	}
 	if (!(pcicmd & PCI_COMMAND_IO)) {	/* is device disabled? */
 		ret = ide_pci_configure(dev, d);
 		if (ret < 0)
-			goto err_disable;
+			goto out;
 		*config = 1;
 		printk(KERN_INFO "%s: device enabled (Linux)\n", d->name);
 	}
@@ -558,17 +556,6 @@
 		printk(KERN_INFO "%s: chipset revision %d\n", d->name, class_rev);
 out:
 	return ret;
-
-err_disable:
-	pci_disable_device(dev);
-	goto out;
-}
-
-static void ide_release_pci_controller(struct pci_dev *dev, ide_pci_device_t *d,
-				       int noisy)
-{
-	/* Balance ide_pci_enable() */
-	pci_disable_device(dev);
 }

 /**
@@ -701,7 +688,7 @@
 		 */
 		ret = d->init_chipset ? d->init_chipset(dev, d->name) : 0;
 		if (ret < 0)
-			goto err_release_pci_controller;
+			goto out;
 		pciirq = ret;
 	} else if (tried_config) {
 		if (noisy)
@@ -716,7 +703,7 @@
 		if (d->init_chipset) {
 			ret = d->init_chipset(dev, d->name);
 			if (ret < 0)
-				goto err_release_pci_controller;
+				goto out;
 		}
 		if (noisy)
 #ifdef __sparc__
@@ -734,10 +721,6 @@
 	ide_pci_setup_ports(dev, d, pciirq, index);
 out:
 	return ret;
-
-err_release_pci_controller:
-	ide_release_pci_controller(dev, d, noisy);
-	goto out;
 }

 int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
diff -Nru a/drivers/pci/quirks.c b/drivers/pci/quirks.c
--- a/drivers/pci/quirks.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/pci/quirks.c	2005-01-07 04:16:03 +01:00
@@ -699,6 +699,26 @@
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, quirk_svwks_csb5ide );

+/*
+ *	Intel 82801CAM ICH3-M datasheet says IDE modes must be the same
+ */
+static void __init quirk_ide_samemode(struct pci_dev *pdev)
+{
+	u8 prog;
+
+	pci_read_config_byte(pdev, PCI_CLASS_PROG, &prog);
+
+	if (((prog & 1) && !(prog & 4)) || ((prog & 4) && !(prog & 1))) {
+		printk(KERN_INFO "PCI: IDE mode mismatch; forcing legacy mode\n");
+		prog &= ~5;
+		pdev->class &= ~5;
+		pci_write_config_byte(pdev, PCI_CLASS_PROG, prog);
+		/* need to re-assign BARs for compat mode */
+		quirk_ide_bases(pdev);
+	}
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, quirk_ide_samemode);
+
 /* This was originally an Alpha specific thing, but it really fits here.
  * The i82375 PCI/EISA bridge appears as non-classified. Fix that.
  */
diff -Nru a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
--- a/drivers/scsi/ide-scsi.c	2005-01-07 04:16:03 +01:00
+++ b/drivers/scsi/ide-scsi.c	2005-01-07 04:16:03 +01:00
@@ -301,23 +301,9 @@
 	return ide_do_drive_cmd(drive, rq, ide_preempt);
 }

-ide_startstop_t idescsi_atapi_error (ide_drive_t *drive, const char *msg, byte stat)
+static ide_startstop_t
+idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
 {
-	struct request *rq;
-	byte err;
-
-	err = ide_dump_atapi_status(drive, msg, stat);
-
-	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
-		return ide_stopped;
-
-	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
-		rq->errors = 1;
-		ide_end_drive_cmd(drive, stat, err);
-		return ide_stopped;
-	}
-
 	if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
 		/* force an abort */
 		HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
@@ -327,20 +313,9 @@
 	return ide_stopped;
 }

-ide_startstop_t idescsi_atapi_abort (ide_drive_t *drive, const char *msg)
+static ide_startstop_t
+idescsi_atapi_abort(ide_drive_t *drive, struct request *rq)
 {
-	struct request *rq;
-
-	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
-	       return ide_stopped;
-
-	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
-		rq->errors = 1;
-		ide_end_drive_cmd(drive, BUSY_STAT, 0);
-		return ide_stopped;
-	}
-
 #if IDESCSI_DEBUG_LOG
 	printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n",
 			((idescsi_pc_t *) rq->special)->scsi_cmd->serial_number);
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2005-01-07 04:16:03 +01:00
+++ b/include/linux/ide.h	2005-01-07 04:16:03 +01:00
@@ -1097,9 +1097,8 @@
 	int		(*cleanup)(ide_drive_t *);
 	ide_startstop_t	(*do_request)(ide_drive_t *, struct request *, sector_t);
 	int		(*end_request)(ide_drive_t *, int, int);
-	u8		(*sense)(ide_drive_t *, const char *, u8);
-	ide_startstop_t	(*error)(ide_drive_t *, const char *, u8);
-	ide_startstop_t	(*abort)(ide_drive_t *, const char *);
+	ide_startstop_t	(*error)(ide_drive_t *, struct request *rq, u8, u8);
+	ide_startstop_t	(*abort)(ide_drive_t *, struct request *rq);
 	int		(*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
 	void		(*pre_reset)(ide_drive_t *);
 	sector_t	(*capacity)(ide_drive_t *);
@@ -1147,12 +1146,7 @@
  */
 extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *);

-/*
- * Error reporting, in human readable form (luxurious, but a memory hog).
- *
- * (drive, msg, status)
- */
-byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat);
+ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);

 /*
  * ide_error() takes action based on the error returned by the controller.
@@ -1162,6 +1156,8 @@
  */
 ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);

+ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
+
 /*
  * Abort a running command on the controller triggering the abort
  * from a host side, non error situation
@@ -1192,11 +1188,6 @@
 extern int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);

 /*
- * Return the current idea about the total capacity of this drive.
- */
-extern sector_t current_capacity (ide_drive_t *drive);
-
-/*
  * Start a reset operation for an IDE interface.
  * The caller should return immediately after invoking this.
  */
@@ -1511,7 +1502,8 @@
 extern char *ide_xfer_verbose(u8 xfer_rate);
 extern void ide_toggle_bounce(ide_drive_t *drive, int on);
 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
-extern byte ide_dump_atapi_status(ide_drive_t *drive, const char *msg, byte stat);
+
+u8 ide_dump_status(ide_drive_t *, const char *, u8);

 typedef struct ide_pio_timings_s {
 	int	setup_time;	/* Address setup (ns) minimum */

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-12-10 19:40 Bartlomiej Zolnierkiewicz
  2004-12-10 21:15 ` Bartlomiej Zolnierkiewicz
@ 2004-12-14 18:23 ` Enrico Scholz
  1 sibling, 0 replies; 53+ messages in thread
From: Enrico Scholz @ 2004-12-14 18:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Bartlomiej Zolnierkiewicz

bzolnier@elka.pw.edu.pl (Bartlomiej Zolnierkiewicz) writes:

> <bzolnier@trik.(none)> (04/12/10 1.2184)
>    [ide] atiixp: add new PCI identifier

* beside the new ID 1002:4369, the ID 4376 should be added also (both
  are ATA133 controllers driven by the same Windoze driver)

* ID 1002:4379 works with the same atiixp.c driver, but it is a SATA
  device. Although the SCSI layer should be used for SATA devices, is it
  be possible to use the IDE driver for now? Else, this chipset would be
  unsupported.

  The device is called "ATI 4379 Serial ATA Controller"

* The windoze driver lists the IDs :436E (both in the ATA133 and SATA
  driver)  and :437A (only SATA), but I never tested them.




Enrico

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-12-10 19:40 Bartlomiej Zolnierkiewicz
@ 2004-12-10 21:15 ` Bartlomiej Zolnierkiewicz
  2004-12-14 18:23 ` Enrico Scholz
  1 sibling, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-12-10 21:15 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 119 bytes --]


I'm a moron and I don't know how to configure KMail in FC3
so not mangled patch attached this time, sorry for that...

[-- Attachment #2: ide-2.6.patch --]
[-- Type: text/x-diff, Size: 17464 bytes --]

diff -Nru a/Documentation/ioctl/cdrom.txt b/Documentation/ioctl/cdrom.txt
--- a/Documentation/ioctl/cdrom.txt	2004-12-10 20:16:48 +01:00
+++ b/Documentation/ioctl/cdrom.txt	2004-12-10 20:16:48 +01:00
@@ -34,7 +34,7 @@
 				  (struct cdrom_multisession)
 	CDROM_GET_MCN		Obtain the "Universal Product Code"
 				   if available (struct cdrom_mcn)
-	CDROM_GET_UPC		CDROM_GET_MCN  (deprecated)
+	CDROM_GET_UPC		Deprecated, use CDROM_GET_MCN instead.
 	CDROMRESET		hard-reset the drive
 	CDROMVOLREAD		Get the drive's volume setting
 					  (struct cdrom_volctrl)
@@ -44,8 +44,8 @@
 	CDROMSEEK		seek msf address
 	CDROMPLAYBLK		scsi-cd only, (struct cdrom_blk)
 	CDROMREADALL		read all 2646 bytes
-	CDROMGETSPINDOWN
-	CDROMSETSPINDOWN
+	CDROMGETSPINDOWN	return 4-bit spindown value
+	CDROMSETSPINDOWN	set 4-bit spindown value
 	CDROMCLOSETRAY		pendant of CDROMEJECT
 	CDROM_SET_OPTIONS	Set behavior options
 	CDROM_CLEAR_OPTIONS	Clear behavior options
@@ -79,10 +79,12 @@
 General:
 
 	Unless otherwise specified, all ioctl calls return 0 on success
-	and -1 with errno set to an appropriate value on error.
+	and -1 with errno set to an appropriate value on error.  (Some
+	ioctls return non-negative data values.)
 
-	Unless otherwise specified, all ioctl calls return EFAULT on a
-	failed attempt to copy data to or from user address space.
+	Unless otherwise specified, all ioctl calls return -1 and set
+	errno to EFAULT on a failed attempt to copy data to or from user
+	address space.
 
 	Individual drivers may return error codes not listed here.
 
@@ -136,6 +138,9 @@
 	  ENOSYS	cd drive not audio-capable.
 
 	notes:
+	  MSF stands for minutes-seconds-frames
+	  LBA stands for logical block address
+
 	  Segment is described as start and end times, where each time
 	  is described as minutes:seconds:frames.  A frame is 1/75 of
 	  a second.
@@ -196,8 +201,11 @@
 	error return:
 	  ENOSYS	cd drive not audio-capable.
 	  EINVAL	entry.cdte_format not CDROM_MSF or CDROM_LBA
+	  EINVAL	requested track out of bounds
+	  EIO		I/O error reading TOC
 
 	notes:
+	  TOC stands for Table Of Contents
 	  MSF stands for minutes-seconds-frames
 	  LBA stands for logical block address
 
@@ -216,6 +224,10 @@
 	error return:
 	  ENOSYS	cd drive not audio-capable.
 
+	notes:
+	  Exact interpretation of this ioctl depends on the device,
+	  but most seem to spin the drive down.
+
 
 CDROMSTART			Start the cdrom drive
 
@@ -230,6 +242,11 @@
 	error return:
 	  ENOSYS	cd drive not audio-capable.
 
+	notes:
+	  Exact interpretation of this ioctl depends on the device,
+	  but most seem to spin the drive up and/or close the tray.
+	  Other devices ignore the ioctl completely.
+
 
 CDROMEJECT			Ejects the cdrom media
 
@@ -241,9 +258,12 @@
 
 	outputs:	none
 
-	error return:
+	error returns:
 	  ENOSYS	cd drive not capable of ejecting
-	  EBUSY		other processes have drive open or door is locked
+	  EBUSY		other processes are accessing drive, or door is locked
+
+	notes:
+	  See CDROM_LOCKDOOR, below.
 
 
 
@@ -257,9 +277,12 @@
 
 	outputs:	none
 
-	error return:
+	error returns:
 	  ENOSYS	cd drive not capable of ejecting
-	  EBUSY		other processes have drive open or door is locked
+	  EBUSY		other processes are accessing drive, or door is locked
+
+	notes:
+	  See CDROM_LOCKDOOR, below.
 
 
 
@@ -577,7 +600,7 @@
 
 	inputs:
 	  New values for drive options.  The logical 'or' of:
-	    CDO_AUTO_CLOSE	close tray on first open
+	    CDO_AUTO_CLOSE	close tray on first open(2)
 	    CDO_AUTO_EJECT	open tray on last release
 	    CDO_USE_FFLAGS	use O_NONBLOCK information on open
 	    CDO_LOCK		lock tray on open files
@@ -918,6 +941,10 @@
 	outputs:
 	  The next writable block.
 
+	notes:
+	  If the device does not support this ioctl directly, the
+	  ioctl will return CDROM_LAST_WRITTEN + 7.
+
 
 
 CDROM_LAST_WRITTEN		get last block written on disc
@@ -925,11 +952,15 @@
 	usage:
 
 	  long last;
-	  ioctl(fd, CDROM_NEXT_WRITABLE, &last);
+	  ioctl(fd, CDROM_LAST_WRITTEN, &last);
 
 	inputs:		none
 
 	outputs:
 	  The last block written on disc
 
-
+	notes:
+	  If the device does not support this ioctl directly, the
+	  result is derived from the disc's table of contents.  If the
+	  table of contents can't be read, this ioctl returns an
+	  error.
diff -Nru a/Documentation/ioctl/hdio.txt b/Documentation/ioctl/hdio.txt
--- a/Documentation/ioctl/hdio.txt	2004-12-10 20:16:48 +01:00
+++ b/Documentation/ioctl/hdio.txt	2004-12-10 20:16:48 +01:00
@@ -28,7 +28,7 @@
 	HDIO_GET_IDENTITY	get IDE identification info
 	HDIO_GET_WCACHE		get write cache mode on|off
 	HDIO_GET_ACOUSTIC	get acoustic value
-	HDIO_GET_ADDRESS
+	HDIO_GET_ADDRESS	get sector addressing mode
 	HDIO_GET_BUSSTATE	get the bus state of the hwif
 	HDIO_TRISTATE_HWIF	execute a channel tristate
 	HDIO_DRIVE_RESET	execute a device reset
@@ -55,8 +55,8 @@
 	HDIO_SET_QDMA		change use-qdma flag
 	HDIO_SET_ADDRESS	change lba addressing modes
 
-	HDIO_SET_IDE_SCSI
-	HDIO_SET_SCSI_IDE
+	HDIO_SET_IDE_SCSI	Set scsi emulation mode on/off
+	HDIO_SET_SCSI_IDE	not implemented yet
 
 
 The information that follows was determined from reading kernel source
@@ -73,8 +73,9 @@
 	Unless otherwise specified, all ioctl calls return 0 on success
 	and -1 with errno set to an appropriate value on error.
 
-	Unless otherwise specified, all ioctl calls return EFAULT on a
-	failed attempt to copy data to or from user address space.
+	Unless otherwise specified, all ioctl calls return -1 and set
+	errno to EFAULT on a failed attempt to copy data to or from user
+	address space.
 
 	Unless otherwise specified, all data structures and constants
 	are defined in <linux/hdreg.h>
@@ -145,7 +146,7 @@
 
 	usage:
 
-	  long val;
+	  unsigned long val;
 	  ioctl(fd, HDIO_SET_UNMASKINTR, val);
 
 	inputs:
@@ -204,7 +205,7 @@
 
 	    This is tightly woven into the driver->do_special can not
 	    touch.  DON'T do it again until a total personality rewrite
-	    is committed."
+	    is committed.
 
 	  If blockmode has already been set, this ioctl will fail with
 	  EBUSY
@@ -371,14 +372,12 @@
 
 	usage:
 
-	  int nice;
+	  unsigned long nice;
 	  ...
 	  ioctl(fd, HDIO_SET_NICE, nice);
 
 	inputs:
-	  args[0]	io address to probe
-	  args[1]	control address to probe
-	  args[2]	irq number
+	  bitmask of nice flags.
 
 	outputs:	none
 
@@ -392,6 +391,9 @@
 	  This ioctl sets the DSC_OVERLAP and NICE_1 flags from values
 	  provided by the user.
 
+	  Nice flags are listed in <linux/hdreg.h>, starting with
+	  IDE_NICE_DSC_OVERLAP.  These values represent shifts.
+
 
 
 
@@ -509,7 +511,7 @@
 
 	notes:
 
-	  Aborts any current command, prevent anything else from being
+	  Abort any current command, prevent anything else from being
 	  queued, execute a reset on the device, and issue BLKRRPART
 	  ioctl on the block device.
 
@@ -523,6 +525,10 @@
 	Note:  If you don't have a copy of the ANSI ATA specification
 	handy, you should probably ignore this ioctl.
 
+	Execute an ATA disk command directly by writing the "taskfile"
+	registers of the drive.  Requires ADMIN and RAWIO access
+	privileges.
+
 	usage:
 
 	  struct {
@@ -541,27 +547,27 @@
 
 	  (See below for details on memory area passed to ioctl.)
 
-	  io_ports[]	values to be written to taskfile registers
-	  hob_ports[]	values to be written to taskfile registers
+	  io_ports[8]	values to be written to taskfile registers
+	  hob_ports[8]	high-order bytes, for extended commands.
 	  out_flags	flags indicating which registers are valid
 	  in_flags	flags indicating which registers should be returned
 	  data_phase	see below
 	  req_cmd	command type to be executed
 	  out_size	size of output buffer
 	  outbuf	buffer of data to be transmitted to disk
-	  inbuf		buffer of data to be received from disk
+	  inbuf		buffer of data to be received from disk (see [1])
 
 	outputs:
 
 	  io_ports[]	values returned in the taskfile registers
-	  hob_ports[]	values returned in the taskfile registers
-	  out_flags	flags indicating which registers are valid
+	  hob_ports[]	high-order bytes, for extended commands.
+	  out_flags	flags indicating which registers are valid (see [2])
 	  in_flags	flags indicating which registers should be returned
-	  outbuf	buffer of data to be transmitted to disk
+	  outbuf	buffer of data to be transmitted to disk (see [1])
 	  inbuf		buffer of data to be received from disk
 
 	error returns:
-	  EACCES	CAP_SYS_ADMIN or CAP_SYS_RAWIO privelege not set.
+	  EACCES	CAP_SYS_ADMIN or CAP_SYS_RAWIO privilege not set.
 	  ENOMSG	Device is not a disk drive.
 	  ENOMEM	Unable to allocate memory for task
 	  EFAULT	req_cmd == TASKFILE_IN_OUT (not implemented as of 2.6.8)
@@ -571,9 +577,14 @@
 
 	notes:
 
-	  Execute an ATA disk command directly by writing the "taskfile"
-	  registers of the drive.  Requires ADMIN and RAWIO access
-	  privileges.
+	  [1] Currently (2.6.8), both the input and output buffers are
+	  copied from the user and written back to the user, even when
+	  not used.  This may be a bug.
+
+	  [2] The out_flags and in_flags are returned to the user after
+	  the ioctl completes.	Currently (2.6.8) these are the same
+	  as the input values, unchanged.  In the future, they may have
+	  more significance.
 
 	  Extreme caution should be used with using this ioctl.  A
 	  mistake can easily corrupt data or hang the system.
@@ -590,7 +601,7 @@
 	    hob_ports[8]	high-order bytes, for extended commands
 	    out_flags		flags indicating which entries in the
 	    			io_ports[] and hob_ports[] arrays
-				contain valid values.
+				contain valid values.  Type ide_reg_valid_t.
 	    in_flags		flags indicating which entries in the
 	    			io_ports[] and hob_ports[] arrays
 				are expected to contain valid values
@@ -600,8 +611,11 @@
 	    out_size		output (user->drive) buffer size, bytes
 	    in_size		input (drive->user) buffer size, bytes
 
-	  Unused fields of io_ports[] and hob_ports[] should be set to
-	  zero.
+	  This ioctl does not necessarily respect all flags in the
+	  out_flags and in_flags values -- some taskfile registers
+	  may be written or read even if not requested in the flags.
+	  Unused fields of io_ports[] and hob_ports[] should be set
+	  to zero.
 
 	  The data_phase field describes the data transfer to be
 	  performed.  Value is one of:
@@ -631,10 +645,6 @@
 	    IDE_DRIVE_TASK_OUT
 	    IDE_DRIVE_TASK_RAW_WRITE
 
-	  Currently (2.6.8), both the input and output buffers are
-	  copied from the user and written back to the user, even when
-	  not used.
-
 
 
 
@@ -666,11 +676,17 @@
 	    args[0]	status
 	    args[1]	error
 	    args[2]	NSECTOR
+	    args[3]	undefined
+	    args[4+]	NSECTOR * 512 bytes of data returned by the command.
 
 	error returns:
 	  EACCES	Access denied:  requires CAP_SYS_RAWIO
 	  ENOMEM	Unable to allocate memory for task
 
+	notes:
+
+	  Taskfile registers IDE_LCYL, IDE_HCYL, and IDE_SELECT are
+	  set to zero before executing the command.
 
 
 
diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/ide-cd.c	2004-12-10 20:16:48 +01:00
@@ -890,8 +890,14 @@
 		ide_execute_command(drive, WIN_PACKETCMD, handler, ATAPI_WAIT_PC, cdrom_timer_expiry);
 		return ide_started;
 	} else {
+		unsigned long flags;
+
 		/* packet command */
-		HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+		spin_lock_irqsave(&ide_lock, flags);
+		hwif->OUTBSYNC(drive, WIN_PACKETCMD, IDE_COMMAND_REG);
+		ndelay(400);
+		spin_unlock_irqrestore(&ide_lock, flags);
+
 		return (*handler) (drive);
 	}
 }
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/ide-dma.c	2004-12-10 20:16:48 +01:00
@@ -131,11 +131,9 @@
 	{ "CD-ROM Drive/F5A",	"ALL"		},
 	{ "WPI CDD-820",		"ALL"		},
 	{ "SAMSUNG CD-ROM SC-148C",	"ALL"		},
-	{ "SAMSUNG CD-ROM SC-148F",	"ALL"		},
 	{ "SAMSUNG CD-ROM SC",	"ALL"		},
 	{ "SanDisk SDP3B-64"	,	"ALL"		},
 	{ "SAMSUNG CD-ROM SN-124",	"ALL"		},
-	{ "PLEXTOR CD-R PX-W8432T",	"ALL"		},
 	{ "ATAPI CD-ROM DRIVE 40X MAXIMUM",	"ALL"		},
 	{ "_NEC DV5800A",               "ALL"           },  
 	{ NULL			,	NULL		}
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/ide-probe.c	2004-12-10 20:16:48 +01:00
@@ -1327,9 +1327,6 @@
 	for (index = 0; index < MAX_HWIFS; ++index)
 		probe[index] = !ide_hwifs[index].present;
 
-	/*
-	 * Probe for drives in the usual way.. CMOS/BIOS, then poke at ports
-	 */
 	for (index = 0; index < MAX_HWIFS; ++index)
 		if (probe[index])
 			probe_hwif(&ide_hwifs[index]);
diff -Nru a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
--- a/drivers/ide/legacy/ali14xx.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/ali14xx.c	2004-12-10 20:16:48 +01:00
@@ -226,6 +226,8 @@
 	probe_hwif_init(hwif);
 	probe_hwif_init(mate);
 
+	create_proc_ide_interfaces();
+
 	return 0;
 }
 
diff -Nru a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
--- a/drivers/ide/legacy/dtc2278.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/dtc2278.c	2004-12-10 20:16:48 +01:00
@@ -141,6 +141,8 @@
 	probe_hwif_init(hwif);
 	probe_hwif_init(mate);
 
+	create_proc_ide_interfaces();
+
 	return 0;
 }
 
diff -Nru a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
--- a/drivers/ide/legacy/ht6560b.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/ht6560b.c	2004-12-10 20:16:48 +01:00
@@ -352,6 +352,8 @@
 	probe_hwif_init(hwif);
 	probe_hwif_init(mate);
 
+	create_proc_ide_interfaces();
+
 	return 0;
 
 release_region:
diff -Nru a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
--- a/drivers/ide/legacy/qd65xx.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/qd65xx.c	2004-12-10 20:16:48 +01:00
@@ -429,6 +429,9 @@
 
 		qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA,
 			 &qd6500_tune_drive);
+
+		create_proc_ide_interfaces();
+
 		return 1;
 	}
 
@@ -459,6 +462,8 @@
 				 &qd6580_tune_drive);
 			qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
 
+			create_proc_ide_interfaces();
+
 			return 1;
 		} else {
 			ide_hwif_t *mate;
@@ -476,6 +481,8 @@
 				 QD6580_DEF_DATA2, QD6580_DEF_DATA2,
 				 &qd6580_tune_drive);
 			qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
+
+			create_proc_ide_interfaces();
 
 			return 0; /* no other qd65xx possible */
 		}
diff -Nru a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
--- a/drivers/ide/legacy/umc8672.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/umc8672.c	2004-12-10 20:16:48 +01:00
@@ -161,6 +161,8 @@
 	probe_hwif_init(hwif);
 	probe_hwif_init(mate);
 
+	create_proc_ide_interfaces();
+
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
--- a/drivers/ide/pci/alim15x3.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/pci/alim15x3.c	2004-12-10 20:16:48 +01:00
@@ -8,6 +8,7 @@
  *  Copyright (C) 1998-2000 Andre Hedrick (andre@linux-ide.org)
  *  May be copied or modified under the terms of the GNU General Public License
  *  Copyright (C) 2002 Alan Cox <alan@redhat.com>
+ *  ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw>
  *
  *  (U)DMA capable version of ali 1533/1543(C), 1535(D)
  *
@@ -799,8 +800,9 @@
 	s8 irq_routing_table[] = { -1,  9, 3, 10, 4,  5, 7,  6,
 				      1, 11, 0, 12, 0, 14, 0, 15 };
 	int irq = -1;
-	
-	hwif->irq = hwif->channel ? 15 : 14;
+
+	if (hwif->pci_dev->device == PCI_DEVICE_ID_AL_M5229)
+		hwif->irq = hwif->channel ? 15 : 14;
 
 	if (isa_dev) {
 		/*
@@ -889,6 +891,7 @@
 
 static struct pci_device_id alim15x3_pci_tbl[] = {
 	{ PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5229, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5228, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ 0, },
 };
 MODULE_DEVICE_TABLE(pci, alim15x3_pci_tbl);
diff -Nru a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
--- a/drivers/ide/pci/atiixp.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/pci/atiixp.c	2004-12-10 20:16:48 +01:00
@@ -347,6 +347,7 @@
 
 static struct pci_device_id atiixp_pci_tbl[] = {
 	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP2_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{ 0, },
 };
 MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c	2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/pci/pdc202xx_old.c	2004-12-10 20:16:48 +01:00
@@ -230,7 +230,7 @@
 {
 	u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10);
 	pci_read_config_word(hwif->pci_dev, 0x50, &CIS);
-	return ((u8)(CIS & mask));
+	return (CIS & mask) ? 1 : 0;
 }
 
 /*
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
--- a/include/linux/pci_ids.h	2004-12-10 20:16:48 +01:00
+++ b/include/linux/pci_ids.h	2004-12-10 20:16:48 +01:00
@@ -344,6 +344,7 @@
 #define PCI_DEVICE_ID_ATI_RS300_200	0x5833
 /* ATI IXP Chipset */
 #define PCI_DEVICE_ID_ATI_IXP_IDE	0x4349
+#define PCI_DEVICE_ID_ATI_IXP2_IDE	0x4369	/* True name not yet sure */
 
 #define PCI_VENDOR_ID_VLSI		0x1004
 #define PCI_DEVICE_ID_VLSI_82C592	0x0005
@@ -1029,6 +1030,7 @@
 #define PCI_DEVICE_ID_AL_M3307		0x3307
 #define PCI_DEVICE_ID_AL_M4803		0x5215
 #define PCI_DEVICE_ID_AL_M5219		0x5219
+#define PCI_DEVICE_ID_AL_M5228		0x5228
 #define PCI_DEVICE_ID_AL_M5229		0x5229
 #define PCI_DEVICE_ID_AL_M5237		0x5237
 #define PCI_DEVICE_ID_AL_M5243		0x5243

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-12-10 19:40 Bartlomiej Zolnierkiewicz
  2004-12-10 21:15 ` Bartlomiej Zolnierkiewicz
  2004-12-14 18:23 ` Enrico Scholz
  0 siblings, 2 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-12-10 19:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi Linus,

Just a bunch of bugfixes.

Please do a

 bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 Documentation/ioctl/cdrom.txt  |   57 ++++++++++++++++++++++++-------
 Documentation/ioctl/hdio.txt   |   74 ++++++++++++++++++++++++-----------------
 drivers/ide/ide-cd.c           |    8 +++-
 drivers/ide/ide-dma.c          |    2 -
 drivers/ide/ide-probe.c        |    3 -
 drivers/ide/legacy/ali14xx.c   |    2 +
 drivers/ide/legacy/dtc2278.c   |    2 +
 drivers/ide/legacy/ht6560b.c   |    2 +
 drivers/ide/legacy/qd65xx.c    |    7 +++
 drivers/ide/legacy/umc8672.c   |    2 +
 drivers/ide/pci/alim15x3.c     |    7 ++-
 drivers/ide/pci/atiixp.c       |    1 
 drivers/ide/pci/pdc202xx_old.c |    2 -
 include/linux/pci_ids.h        |    2 +
 14 files changed, 120 insertions(+), 51 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/12/10 1.2189)
   [ide] remove obsolete comment from ide-probe.c
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/10 1.2188)
   [ide] fix creating of /proc/ide/ entries for legacy VLB modules
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/10 1.2187)
   [ide] final polish on disk ioctl documentation
   
   From: Edward Falk <efalk@google.com>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/10 1.2186)
   [ide] ide-cd: fix possible race in PIO mode
   
   From: Alan Cox <alan@lxorguk.ukuu.org.uk>
   
   When we issue an ide command the status bits don't become valid for
   400nS. In the DMA case ide_execute_command handles this but in the PIO
   case we don't do the needed locking, use OUTBSYNC to avoid posting or
   delay. This means that in some situations we can execute the command
   handler in PIO mode before the command status bits are valid and the
   handler may read and act wrongly.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/10 1.2185)
   [ide] alim15x3: add support for ULi M5228
   
   From: Clear Zhang <Clear.Zhang@uli.com.tw>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/10 1.2184)
   [ide] atiixp: add new PCI identifier
   
   From: Pascal Lengard <lklm@lengard.net>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/10 1.2183)
   [ide] pdc202xx_old: fix cable detection
   
   pdc202xx_old_cable_detect() always returns '0' (which means 80c cable)
   due to a sloppy coding - result of CIS & mask is truncated to 8 bits
   although CIS holds cable info in bits 10-11.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/10 1.2182)
   [ide] remove SAMSUNG CD-ROM SC-148F from the DMA blacklist
   
   Reported to work OK by Alexander E. Patrakov <patrakov@ums.usu.ru>.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/12/10 1.2181)
   [ide] remove PLEXTOR CD-R PX-W8432T from the DMA blacklist
   
   Reported to work OK by Junio C Hamano <junkio@cox.net>,
   DervishD <lkml@dervishd.net> and Anton <_xman_@mail.ru>.
   
   Fixes bugzilla bug #3730.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/Documentation/ioctl/cdrom.txt b/Documentation/ioctl/cdrom.txt
--- a/Documentation/ioctl/cdrom.txt 2004-12-10 20:16:48 +01:00
+++ b/Documentation/ioctl/cdrom.txt 2004-12-10 20:16:48 +01:00
@@ -34,7 +34,7 @@
       (struct cdrom_multisession)
  CDROM_GET_MCN  Obtain the "Universal Product Code"
        if available (struct cdrom_mcn)
- CDROM_GET_UPC  CDROM_GET_MCN  (deprecated)
+ CDROM_GET_UPC  Deprecated, use CDROM_GET_MCN instead.
  CDROMRESET  hard-reset the drive
  CDROMVOLREAD  Get the drive's volume setting
        (struct cdrom_volctrl)
@@ -44,8 +44,8 @@
  CDROMSEEK  seek msf address
  CDROMPLAYBLK  scsi-cd only, (struct cdrom_blk)
  CDROMREADALL  read all 2646 bytes
- CDROMGETSPINDOWN
- CDROMSETSPINDOWN
+ CDROMGETSPINDOWN return 4-bit spindown value
+ CDROMSETSPINDOWN set 4-bit spindown value
  CDROMCLOSETRAY  pendant of CDROMEJECT
  CDROM_SET_OPTIONS Set behavior options
  CDROM_CLEAR_OPTIONS Clear behavior options
@@ -79,10 +79,12 @@
 General:
 
  Unless otherwise specified, all ioctl calls return 0 on success
- and -1 with errno set to an appropriate value on error.
+ and -1 with errno set to an appropriate value on error.  (Some
+ ioctls return non-negative data values.)
 
- Unless otherwise specified, all ioctl calls return EFAULT on a
- failed attempt to copy data to or from user address space.
+ Unless otherwise specified, all ioctl calls return -1 and set
+ errno to EFAULT on a failed attempt to copy data to or from user
+ address space.
 
  Individual drivers may return error codes not listed here.
 
@@ -136,6 +138,9 @@
    ENOSYS cd drive not audio-capable.
 
  notes:
+   MSF stands for minutes-seconds-frames
+   LBA stands for logical block address
+
    Segment is described as start and end times, where each time
    is described as minutes:seconds:frames.  A frame is 1/75 of
    a second.
@@ -196,8 +201,11 @@
  error return:
    ENOSYS cd drive not audio-capable.
    EINVAL entry.cdte_format not CDROM_MSF or CDROM_LBA
+   EINVAL requested track out of bounds
+   EIO  I/O error reading TOC
 
  notes:
+   TOC stands for Table Of Contents
    MSF stands for minutes-seconds-frames
    LBA stands for logical block address
 
@@ -216,6 +224,10 @@
  error return:
    ENOSYS cd drive not audio-capable.
 
+ notes:
+   Exact interpretation of this ioctl depends on the device,
+   but most seem to spin the drive down.
+
 
 CDROMSTART   Start the cdrom drive
 
@@ -230,6 +242,11 @@
  error return:
    ENOSYS cd drive not audio-capable.
 
+ notes:
+   Exact interpretation of this ioctl depends on the device,
+   but most seem to spin the drive up and/or close the tray.
+   Other devices ignore the ioctl completely.
+
 
 CDROMEJECT   Ejects the cdrom media
 
@@ -241,9 +258,12 @@
 
  outputs: none
 
- error return:
+ error returns:
    ENOSYS cd drive not capable of ejecting
-   EBUSY  other processes have drive open or door is locked
+   EBUSY  other processes are accessing drive, or door is locked
+
+ notes:
+   See CDROM_LOCKDOOR, below.
 
 
 
@@ -257,9 +277,12 @@
 
  outputs: none
 
- error return:
+ error returns:
    ENOSYS cd drive not capable of ejecting
-   EBUSY  other processes have drive open or door is locked
+   EBUSY  other processes are accessing drive, or door is locked
+
+ notes:
+   See CDROM_LOCKDOOR, below.
 
 
 
@@ -577,7 +600,7 @@
 
  inputs:
    New values for drive options.  The logical 'or' of:
-     CDO_AUTO_CLOSE close tray on first open
+     CDO_AUTO_CLOSE close tray on first open(2)
      CDO_AUTO_EJECT open tray on last release
      CDO_USE_FFLAGS use O_NONBLOCK information on open
      CDO_LOCK  lock tray on open files
@@ -918,6 +941,10 @@
  outputs:
    The next writable block.
 
+ notes:
+   If the device does not support this ioctl directly, the
+   ioctl will return CDROM_LAST_WRITTEN + 7.
+
 
 
 CDROM_LAST_WRITTEN		get last block written on disc
@@ -925,11 +952,15 @@
 	usage:
 
 	  long last;
-	  ioctl(fd, CDROM_NEXT_WRITABLE, &last);
+	  ioctl(fd, CDROM_LAST_WRITTEN, &last);
 
 	inputs:		none
 
 	outputs:
 	  The last block written on disc
 
-
+ notes:
+   If the device does not support this ioctl directly, the
+   result is derived from the disc's table of contents.  If the
+   table of contents can't be read, this ioctl returns an
+   error.
diff -Nru a/Documentation/ioctl/hdio.txt b/Documentation/ioctl/hdio.txt
--- a/Documentation/ioctl/hdio.txt 2004-12-10 20:16:48 +01:00
+++ b/Documentation/ioctl/hdio.txt 2004-12-10 20:16:48 +01:00
@@ -28,7 +28,7 @@
  HDIO_GET_IDENTITY get IDE identification info
  HDIO_GET_WCACHE  get write cache mode on|off
  HDIO_GET_ACOUSTIC get acoustic value
- HDIO_GET_ADDRESS
+ HDIO_GET_ADDRESS get sector addressing mode
  HDIO_GET_BUSSTATE get the bus state of the hwif
  HDIO_TRISTATE_HWIF execute a channel tristate
  HDIO_DRIVE_RESET execute a device reset
@@ -55,8 +55,8 @@
  HDIO_SET_QDMA  change use-qdma flag
  HDIO_SET_ADDRESS change lba addressing modes
 
- HDIO_SET_IDE_SCSI
- HDIO_SET_SCSI_IDE
+ HDIO_SET_IDE_SCSI Set scsi emulation mode on/off
+ HDIO_SET_SCSI_IDE not implemented yet
 
 
 The information that follows was determined from reading kernel source
@@ -73,8 +73,9 @@
  Unless otherwise specified, all ioctl calls return 0 on success
  and -1 with errno set to an appropriate value on error.
 
- Unless otherwise specified, all ioctl calls return EFAULT on a
- failed attempt to copy data to or from user address space.
+ Unless otherwise specified, all ioctl calls return -1 and set
+ errno to EFAULT on a failed attempt to copy data to or from user
+ address space.
 
  Unless otherwise specified, all data structures and constants
 	are defined in <linux/hdreg.h>
@@ -145,7 +146,7 @@
 
 	usage:
 
-	  long val;
+	  unsigned long val;
 	  ioctl(fd, HDIO_SET_UNMASKINTR, val);
 
 	inputs:
@@ -204,7 +205,7 @@
 
 	    This is tightly woven into the driver->do_special can not
 	    touch.  DON'T do it again until a total personality rewrite
-	    is committed."
+	    is committed.
 
 	  If blockmode has already been set, this ioctl will fail with
 	  EBUSY
@@ -371,14 +372,12 @@
 
 	usage:
 
-   int nice;
+   unsigned long nice;
    ...
    ioctl(fd, HDIO_SET_NICE, nice);
 
  inputs:
-   args[0] io address to probe
-   args[1] control address to probe
-   args[2] irq number
+   bitmask of nice flags.
 
  outputs: none
 
@@ -392,6 +391,9 @@
    This ioctl sets the DSC_OVERLAP and NICE_1 flags from values
    provided by the user.
 
+   Nice flags are listed in <linux/hdreg.h>, starting with
+   IDE_NICE_DSC_OVERLAP.  These values represent shifts.
+
 
 
 
@@ -509,7 +511,7 @@
 
 	notes:
 
-	  Aborts any current command, prevent anything else from being
+	  Abort any current command, prevent anything else from being
    queued, execute a reset on the device, and issue BLKRRPART
    ioctl on the block device.
 
@@ -523,6 +525,10 @@
  Note:  If you don't have a copy of the ANSI ATA specification
  handy, you should probably ignore this ioctl.
 
+ Execute an ATA disk command directly by writing the "taskfile"
+ registers of the drive.  Requires ADMIN and RAWIO access
+ privileges.
+
  usage:
 
    struct {
@@ -541,27 +547,27 @@
 
    (See below for details on memory area passed to ioctl.)
 
-   io_ports[] values to be written to taskfile registers
-   hob_ports[] values to be written to taskfile registers
+   io_ports[8] values to be written to taskfile registers
+   hob_ports[8] high-order bytes, for extended commands.
    out_flags flags indicating which registers are valid
    in_flags flags indicating which registers should be returned
    data_phase see below
    req_cmd command type to be executed
    out_size size of output buffer
    outbuf buffer of data to be transmitted to disk
-   inbuf  buffer of data to be received from disk
+   inbuf  buffer of data to be received from disk (see [1])
 
  outputs:
 
    io_ports[] values returned in the taskfile registers
-   hob_ports[] values returned in the taskfile registers
-   out_flags flags indicating which registers are valid
+   hob_ports[] high-order bytes, for extended commands.
+   out_flags flags indicating which registers are valid (see [2])
    in_flags flags indicating which registers should be returned
-   outbuf buffer of data to be transmitted to disk
+   outbuf buffer of data to be transmitted to disk (see [1])
    inbuf  buffer of data to be received from disk
 
  error returns:
-   EACCES CAP_SYS_ADMIN or CAP_SYS_RAWIO privelege not set.
+   EACCES CAP_SYS_ADMIN or CAP_SYS_RAWIO privilege not set.
    ENOMSG Device is not a disk drive.
    ENOMEM Unable to allocate memory for task
    EFAULT req_cmd == TASKFILE_IN_OUT (not implemented as of 2.6.8)
@@ -571,9 +577,14 @@
 
  notes:
 
-   Execute an ATA disk command directly by writing the "taskfile"
-   registers of the drive.  Requires ADMIN and RAWIO access
-   privileges.
+   [1] Currently (2.6.8), both the input and output buffers are
+   copied from the user and written back to the user, even when
+   not used.  This may be a bug.
+
+   [2] The out_flags and in_flags are returned to the user after
+   the ioctl completes. Currently (2.6.8) these are the same
+   as the input values, unchanged.  In the future, they may have
+   more significance.
 
    Extreme caution should be used with using this ioctl.  A
    mistake can easily corrupt data or hang the system.
@@ -590,7 +601,7 @@
      hob_ports[8] high-order bytes, for extended commands
      out_flags  flags indicating which entries in the
         io_ports[] and hob_ports[] arrays
-    contain valid values.
+    contain valid values.  Type ide_reg_valid_t.
      in_flags  flags indicating which entries in the
         io_ports[] and hob_ports[] arrays
     are expected to contain valid values
@@ -600,8 +611,11 @@
      out_size  output (user->drive) buffer size, bytes
      in_size  input (drive->user) buffer size, bytes
 
-   Unused fields of io_ports[] and hob_ports[] should be set to
-   zero.
+   This ioctl does not necessarily respect all flags in the
+   out_flags and in_flags values -- some taskfile registers
+   may be written or read even if not requested in the flags.
+   Unused fields of io_ports[] and hob_ports[] should be set
+   to zero.
 
    The data_phase field describes the data transfer to be
    performed.  Value is one of:
@@ -631,10 +645,6 @@
      IDE_DRIVE_TASK_OUT
      IDE_DRIVE_TASK_RAW_WRITE
 
-   Currently (2.6.8), both the input and output buffers are
-   copied from the user and written back to the user, even when
-   not used.
-
 
 
 
@@ -666,11 +676,17 @@
      args[0] status
      args[1] error
      args[2] NSECTOR
+     args[3] undefined
+     args[4+] NSECTOR * 512 bytes of data returned by the command.
 
  error returns:
    EACCES Access denied:  requires CAP_SYS_RAWIO
    ENOMEM Unable to allocate memory for task
 
+ notes:
+
+   Taskfile registers IDE_LCYL, IDE_HCYL, and IDE_SELECT are
+   set to zero before executing the command.
 
 
 
diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/ide-cd.c 2004-12-10 20:16:48 +01:00
@@ -890,8 +890,14 @@
   ide_execute_command(drive, WIN_PACKETCMD, handler, ATAPI_WAIT_PC, cdrom_timer_expiry);
   return ide_started;
  } else {
+  unsigned long flags;
+
   /* packet command */
-  HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+  spin_lock_irqsave(&ide_lock, flags);
+  hwif->OUTBSYNC(drive, WIN_PACKETCMD, IDE_COMMAND_REG);
+  ndelay(400);
+  spin_unlock_irqrestore(&ide_lock, flags);
+
   return (*handler) (drive);
  }
 }
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/ide-dma.c 2004-12-10 20:16:48 +01:00
@@ -131,11 +131,9 @@
  { "CD-ROM Drive/F5A", "ALL"  },
  { "WPI CDD-820",  "ALL"  },
  { "SAMSUNG CD-ROM SC-148C", "ALL"  },
- { "SAMSUNG CD-ROM SC-148F", "ALL"  },
  { "SAMSUNG CD-ROM SC", "ALL"  },
  { "SanDisk SDP3B-64" , "ALL"  },
  { "SAMSUNG CD-ROM SN-124", "ALL"  },
- { "PLEXTOR CD-R PX-W8432T", "ALL"  },
  { "ATAPI CD-ROM DRIVE 40X MAXIMUM", "ALL"  },
  { "_NEC DV5800A",               "ALL"           },  
  { NULL   , NULL  }
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/ide-probe.c 2004-12-10 20:16:48 +01:00
@@ -1327,9 +1327,6 @@
  for (index = 0; index < MAX_HWIFS; ++index)
   probe[index] = !ide_hwifs[index].present;
 
- /*
-  * Probe for drives in the usual way.. CMOS/BIOS, then poke at ports
-  */
  for (index = 0; index < MAX_HWIFS; ++index)
   if (probe[index])
    probe_hwif(&ide_hwifs[index]);
diff -Nru a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
--- a/drivers/ide/legacy/ali14xx.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/ali14xx.c 2004-12-10 20:16:48 +01:00
@@ -226,6 +226,8 @@
  probe_hwif_init(hwif);
  probe_hwif_init(mate);
 
+ create_proc_ide_interfaces();
+
  return 0;
 }
 
diff -Nru a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
--- a/drivers/ide/legacy/dtc2278.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/dtc2278.c 2004-12-10 20:16:48 +01:00
@@ -141,6 +141,8 @@
  probe_hwif_init(hwif);
  probe_hwif_init(mate);
 
+ create_proc_ide_interfaces();
+
  return 0;
 }
 
diff -Nru a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
--- a/drivers/ide/legacy/ht6560b.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/ht6560b.c 2004-12-10 20:16:48 +01:00
@@ -352,6 +352,8 @@
  probe_hwif_init(hwif);
  probe_hwif_init(mate);
 
+ create_proc_ide_interfaces();
+
  return 0;
 
 release_region:
diff -Nru a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
--- a/drivers/ide/legacy/qd65xx.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/qd65xx.c 2004-12-10 20:16:48 +01:00
@@ -429,6 +429,9 @@
 
   qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA,
     &qd6500_tune_drive);
+
+  create_proc_ide_interfaces();
+
   return 1;
  }
 
@@ -459,6 +462,8 @@
      &qd6580_tune_drive);
    qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
 
+   create_proc_ide_interfaces();
+
    return 1;
   } else {
    ide_hwif_t *mate;
@@ -476,6 +481,8 @@
      QD6580_DEF_DATA2, QD6580_DEF_DATA2,
      &qd6580_tune_drive);
    qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
+
+   create_proc_ide_interfaces();
 
    return 0; /* no other qd65xx possible */
   }
diff -Nru a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
--- a/drivers/ide/legacy/umc8672.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/legacy/umc8672.c 2004-12-10 20:16:48 +01:00
@@ -161,6 +161,8 @@
  probe_hwif_init(hwif);
  probe_hwif_init(mate);
 
+ create_proc_ide_interfaces();
+
  return 0;
 }
 
diff -Nru a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
--- a/drivers/ide/pci/alim15x3.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/pci/alim15x3.c 2004-12-10 20:16:48 +01:00
@@ -8,6 +8,7 @@
  *  Copyright (C) 1998-2000 Andre Hedrick (andre@linux-ide.org)
  *  May be copied or modified under the terms of the GNU General Public License
  *  Copyright (C) 2002 Alan Cox <alan@redhat.com>
+ *  ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw>
  *
  *  (U)DMA capable version of ali 1533/1543(C), 1535(D)
  *
@@ -799,8 +800,9 @@
  s8 irq_routing_table[] = { -1,  9, 3, 10, 4,  5, 7,  6,
           1, 11, 0, 12, 0, 14, 0, 15 };
  int irq = -1;
- 
- hwif->irq = hwif->channel ? 15 : 14;
+
+ if (hwif->pci_dev->device == PCI_DEVICE_ID_AL_M5229)
+  hwif->irq = hwif->channel ? 15 : 14;
 
  if (isa_dev) {
   /*
@@ -889,6 +891,7 @@
 
 static struct pci_device_id alim15x3_pci_tbl[] = {
  { PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5229, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+ { PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5228, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
  { 0, },
 };
 MODULE_DEVICE_TABLE(pci, alim15x3_pci_tbl);
diff -Nru a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
--- a/drivers/ide/pci/atiixp.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/pci/atiixp.c 2004-12-10 20:16:48 +01:00
@@ -347,6 +347,7 @@
 
 static struct pci_device_id atiixp_pci_tbl[] = {
  { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+ { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP2_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
  { 0, },
 };
 MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c 2004-12-10 20:16:48 +01:00
+++ b/drivers/ide/pci/pdc202xx_old.c 2004-12-10 20:16:48 +01:00
@@ -230,7 +230,7 @@
 {
  u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10);
  pci_read_config_word(hwif->pci_dev, 0x50, &CIS);
- return ((u8)(CIS & mask));
+ return (CIS & mask) ? 1 : 0;
 }
 
 /*
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
--- a/include/linux/pci_ids.h 2004-12-10 20:16:48 +01:00
+++ b/include/linux/pci_ids.h 2004-12-10 20:16:48 +01:00
@@ -344,6 +344,7 @@
 #define PCI_DEVICE_ID_ATI_RS300_200 0x5833
 /* ATI IXP Chipset */
 #define PCI_DEVICE_ID_ATI_IXP_IDE 0x4349
+#define PCI_DEVICE_ID_ATI_IXP2_IDE 0x4369 /* True name not yet sure */
 
 #define PCI_VENDOR_ID_VLSI  0x1004
 #define PCI_DEVICE_ID_VLSI_82C592 0x0005
@@ -1029,6 +1030,7 @@
 #define PCI_DEVICE_ID_AL_M3307  0x3307
 #define PCI_DEVICE_ID_AL_M4803  0x5215
 #define PCI_DEVICE_ID_AL_M5219  0x5219
+#define PCI_DEVICE_ID_AL_M5228  0x5228
 #define PCI_DEVICE_ID_AL_M5229  0x5229
 #define PCI_DEVICE_ID_AL_M5237  0x5237
 #define PCI_DEVICE_ID_AL_M5243  0x5243

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-11-17 23:41 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-11-17 23:41 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi,

Bugfixes only except Adrian's cleanup patch
(but it is really obvious and non-intrusive).

Please do a

 bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 Documentation/kernel-parameters.txt |    8 +
 drivers/ide/cris/ide-v10.c          |  173 +++++++++---------------------------
 drivers/ide/ide-cd.c                |    6 -
 drivers/ide/ide-cd.h                |    6 -
 drivers/ide/ide-disk.c              |    4 
 drivers/ide/ide-dma.c               |    1 
 drivers/ide/ide-probe.c             |    2 
 drivers/ide/ide-proc.c              |   20 +++-
 drivers/ide/ide.c                   |    2 
 drivers/ide/legacy/hd.c             |    8 -
 drivers/ide/legacy/qd65xx.c         |    2 
 drivers/ide/legacy/qd65xx.h         |    2 
 drivers/ide/pci/aec62xx.h           |    4 
 drivers/ide/pci/cs5520.c            |    2 
 drivers/ide/pci/cy82c693.c          |    2 
 drivers/ide/pci/hpt366.h            |   38 +++----
 drivers/ide/pci/pdc202xx_new.c      |   56 -----------
 drivers/ide/pci/pdc202xx_old.c      |    2 
 drivers/ide/pci/sc1200.c            |    4 
 drivers/ide/pci/serverworks.h       |    2 
 drivers/ide/pci/trm290.c            |    2 
 21 files changed, 110 insertions(+), 236 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/11/17 1.2274)
   [ide] fix /proc/ide/hd?/settings to not spam logs
   
   On Thu, 11 Nov 2004 17:10:21 +0100, Jens Axboe <axboe@suse.de> wrote:
   > On Thu, Nov 11 2004, Alan Cox wrote:
   > > > +   printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
   > > > +                       "obsolete, and will be removed soon!\n");
   > > > +
   > >
   > > The above should be rate limited or on the write case moved to after
   > > the capable() check. A program polling these settings now makes a nasty
   > > noise and wipes the logs. A user can also do it intentionally.
   > 
   > Or just print it once...
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/17 1.2273)
   [ide] small IDE cleanups
   
   The patch below does the following small cleanups in the IDE code:
   - make some needlessly global code static
   - remove two unused functions from pdc202xx_new.c
   
   Signed-off-by: Adrian Bunk <bunk@stusta.de>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/17 1.2272)
   [ide] remove RICOH CD-R/RW MP7083A from DMA blacklist
   
   From: Srihari Vijayaraghavan <sriharivijayaraghavan@yahoo.com.au>
   
   I have tested my RICOH CD-R/RW with this patch (on CD reading/writing),
   and it works just fine with DMA enabled.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/17 1.2271)
   [ide] "ide=nodma" printout fix
   
   From: Magnus Damm <magnus.damm@gmail.com>
   
   This simple patch changes the output from this:
   ..
   ide_setup: ide=nodmaIDE: Prevented DMA
   ..
   to this:
   ..
   ide_setup: ide=nodma : Prevented DMA
   ..
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/17 1.2270)
   [ide] update documentation for ide params
   
   From: Magnus Damm <magnus.damm@gmail.com>
   
   This patch removes ide parameters marked as obsolete in the source and
   adds documentation for "ide=". I think I got it right, the important
   part for me is "ide=nodma".
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/17 1.2269)
   [ide] no need to alloc sg_table in CRISv10 IDE driver
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/17 1.2268)
   [ide] update CRISv10 IDE driver
   
   Signed-off-by: Mikael Starvik <starvik@axis.com>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
--- a/Documentation/kernel-parameters.txt 2004-11-18 00:15:00 +01:00
+++ b/Documentation/kernel-parameters.txt 2004-11-18 00:15:00 +01:00
@@ -504,10 +504,12 @@
  icn=  [HW,ISDN]
    Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]]
 
+ ide=  [HW] (E)IDE subsystem
+   Format: ide=nodma or ide=doubler or ide=reverse
+   See Documentation/ide.txt.
+
  ide?=  [HW] (E)IDE subsystem
-   Config (iomem/irq), tuning or debugging
-   (serialize,reset,no{dma,tune,probe}) or chipset
-   specific parameters.
+   Format: ide?=noprobe or chipset specific parameters.
    See Documentation/ide.txt.
  
  idebus=  [HW] (E)IDE subsystem - VLB/PCI bus speed
diff -Nru a/drivers/ide/cris/ide-v10.c b/drivers/ide/cris/ide-v10.c
--- a/drivers/ide/cris/ide-v10.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/cris/ide-v10.c 2004-11-18 00:15:00 +01:00
@@ -30,6 +30,7 @@
 #include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/init.h>
+#include <linux/scatterlist.h>
 
 #include <asm/io.h>
 #include <asm/arch/svinto.h>
@@ -50,6 +51,9 @@
 #define LOWDB(x)
 #define D(x)
 
+static int e100_ide_build_dmatable (ide_drive_t *drive);
+static ide_startstop_t etrax_dma_intr (ide_drive_t *drive);
+
 void
 etrax100_ide_outw(unsigned short data, unsigned long reg) {
  int timeleft;
@@ -202,16 +206,13 @@
 #define ATA_PIO0_HOLD    4
 
 static int e100_dma_check (ide_drive_t *drive);
-static int e100_dma_begin (ide_drive_t *drive);
+static void e100_dma_start(ide_drive_t *drive);
 static int e100_dma_end (ide_drive_t *drive);
-static int e100_dma_read (ide_drive_t *drive);
-static int e100_dma_write (ide_drive_t *drive);
 static void e100_ide_input_data (ide_drive_t *drive, void *, unsigned int);
 static void e100_ide_output_data (ide_drive_t *drive, void *, unsigned int);
 static void e100_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
 static void e100_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
 static int e100_dma_off (ide_drive_t *drive);
-static int e100_dma_verbose (ide_drive_t *drive);
 
 
 /*
@@ -276,6 +277,40 @@
  }
 }
 
+static int e100_dma_setup(ide_drive_t *drive)
+{
+ struct request *rq = drive->hwif->hwgroup->rq;
+
+ if (rq_data_dir(rq)) {
+  e100_read_command = 0;
+
+  RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
+  WAIT_DMA(ATA_TX_DMA_NBR);
+ } else {
+  e100_read_command = 1;
+
+  RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
+  WAIT_DMA(ATA_RX_DMA_NBR);
+ }
+
+ /* set up the Etrax DMA descriptors */
+ if (e100_ide_build_dmatable(drive)) {
+  ide_map_sg(drive, rq);
+  return 1;
+ }
+
+ return 0;
+}
+
+static void e100_dma_exec_cmd(ide_drive_t *drive, u8 command)
+{
+ /* set the irq handler which will finish the request when DMA is done */
+ ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
+
+ /* issue cmd to drive */
+ etrax100_ide_outb(command, IDE_COMMAND_REG);
+}
+
 void __init
 init_e100_ide (void)
 {
@@ -297,18 +332,15 @@
                 hwif->atapi_output_bytes = &e100_atapi_output_bytes;
                 hwif->ide_dma_check = &e100_dma_check;
                 hwif->ide_dma_end = &e100_dma_end;
-  hwif->ide_dma_write = &e100_dma_write;
-  hwif->ide_dma_read = &e100_dma_read;
-  hwif->ide_dma_begin = &e100_dma_begin;
+  hwif->dma_setup = &e100_dma_setup;
+  hwif->dma_exec_cmd = &e100_dma_exec_cmd;
+  hwif->dma_start = &e100_dma_start;
   hwif->OUTB = &etrax100_ide_outb;
   hwif->OUTW = &etrax100_ide_outw;
   hwif->OUTBSYNC = &etrax100_ide_outbsync;
   hwif->INB = &etrax100_ide_inb;
   hwif->INW = &etrax100_ide_inw;
   hwif->ide_dma_off_quietly = &e100_dma_off;
-  hwif->ide_dma_verbose = &e100_dma_verbose;
-  hwif->sg_table =
-    kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES, GFP_KERNEL);
  }
 
  /* actually reset and configure the etrax100 ide/ata interface */
@@ -401,12 +433,6 @@
  return 0;
 }
 
-static int e100_dma_verbose (ide_drive_t *drive)
-{
- printk(", DMA(mode 2)");
- return 0;
-}
-
 static etrax_dma_descr mydescr;
 
 /*
@@ -618,20 +644,9 @@
 
  ata_tot_size = 0;
 
- if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) {
-  u8 *virt_addr = rq->buffer;
-  int sector_count = rq->nr_sectors;
-  memset(&sg[0], 0, sizeof(*sg));
-  sg[0].page = virt_to_page(virt_addr);
-  sg[0].offset = offset_in_page(virt_addr);
-  sg[0].length =  sector_count  * SECTOR_SIZE;
-  hwif->sg_nents = i = 1;
- }
- else
- {
-  hwif->sg_nents = i = blk_rq_map_sg(drive->queue, rq, hwif->sg_table);
- }
+ ide_map_sg(drive, rq);
 
+ i = hwif->sg_nents;
 
  while(i) {
   /*
@@ -768,10 +783,6 @@
  * sector address using CHS or LBA.  All that remains is to prepare for DMA
  * and then issue the actual read/write DMA/PIO command to the drive.
  *
- * For ATAPI devices, we just prepare for DMA and return. The caller should
- * then issue the packet command to the drive and call us again with
- * ide_dma_begin afterwards.
- *
  * Returns 0 if all went well.
  * Returns 1 if DMA read/write could not be started, in which case
  * the caller should revert to PIO for the current request.
@@ -788,35 +799,9 @@
  return 0;
 }
 
-static int e100_start_dma(ide_drive_t *drive, int atapi, int reading)
+static void e100_dma_start(ide_drive_t *drive)
 {
- if(reading) {
-
-  RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
-  WAIT_DMA(ATA_RX_DMA_NBR);
-
-  /* set up the Etrax DMA descriptors */
-
-  if(e100_ide_build_dmatable (drive))
-   return 1;
-
-  if(!atapi) {
-   /* set the irq handler which will finish the request when DMA is done */
-
-   ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
-
-   /* issue cmd to drive */
-                        if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
-       (drive->addressing == 1)) {
-    ide_task_t *args = HWGROUP(drive)->rq->special;
-    etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
-   } else if (drive->addressing) {
-    etrax100_ide_outb(WIN_READDMA_EXT, IDE_COMMAND_REG);
-   } else {
-    etrax100_ide_outb(WIN_READDMA, IDE_COMMAND_REG);
-   }
-  }
-
+ if (e100_read_command) {
   /* begin DMA */
 
   /* need to do this before RX DMA due to a chip bug
@@ -849,32 +834,6 @@
 
  } else {
   /* writing */
-
-  RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
-  WAIT_DMA(ATA_TX_DMA_NBR);
-
-  /* set up the Etrax DMA descriptors */
-
-  if(e100_ide_build_dmatable (drive))
-   return 1;
-
-  if(!atapi) {
-   /* set the irq handler which will finish the request when DMA is done */
-
-   ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
-
-   /* issue cmd to drive */
-   if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
-       (drive->addressing == 1)) {
-    ide_task_t *args = HWGROUP(drive)->rq->special;
-    etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
-   } else if (drive->addressing) {
-    etrax100_ide_outb(WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
-   } else {
-    etrax100_ide_outb(WIN_WRITEDMA, IDE_COMMAND_REG);
-   }
-  }
-
   /* begin DMA */
 
   *R_DMA_CH2_FIRST = virt_to_phys(ata_descrs);
@@ -897,44 +856,4 @@
 
   D(printk("dma write of %d bytes.\n", ata_tot_size));
  }
- return 0;
-}
-
-static int e100_dma_write(ide_drive_t *drive)
-{
- e100_read_command = 0;
- /* ATAPI-devices (not disks) first call ide_dma_read/write to set the direction
-  * then they call ide_dma_begin after they have issued the appropriate drive command
-  * themselves to actually start the chipset DMA. so we just return here if we're
-  * not a diskdrive.
-  */
- if (drive->media != ide_disk)
-                return 0;
- return e100_start_dma(drive, 0, 0);
-}
-
-static int e100_dma_read(ide_drive_t *drive)
-{
- e100_read_command = 1;
- /* ATAPI-devices (not disks) first call ide_dma_read/write to set the direction
-  * then they call ide_dma_begin after they have issued the appropriate drive command
-  * themselves to actually start the chipset DMA. so we just return here if we're
-  * not a diskdrive.
-  */
- if (drive->media != ide_disk)
-                return 0;
- return e100_start_dma(drive, 0, 1);
-}
-
-static int e100_dma_begin(ide_drive_t *drive)
-{
- /* begin DMA, used by ATAPI devices which want to issue the
-  * appropriate IDE command themselves.
-  *
-  * they have already called ide_dma_read/write to set the
-  * static reading flag, now they call ide_dma_begin to do
-  * the real stuff. we tell our code below not to issue
-  * any IDE commands itself and jump into it.
-  */
-  return e100_start_dma(drive, 1, e100_read_command);
 }
diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/ide-cd.c 2004-11-18 00:15:00 +01:00
@@ -562,7 +562,7 @@
 /*
  * ide_error() takes action based on the error returned by the drive.
  */
-ide_startstop_t ide_cdrom_error (ide_drive_t *drive, const char *msg, byte stat)
+static ide_startstop_t ide_cdrom_error (ide_drive_t *drive, const char *msg, byte stat)
 {
  struct request *rq;
  byte err;
@@ -598,7 +598,7 @@
  return ide_stopped;
 }
 
-ide_startstop_t ide_cdrom_abort (ide_drive_t *drive, const char *msg)
+static ide_startstop_t ide_cdrom_abort (ide_drive_t *drive, const char *msg)
 {
  struct request *rq;
 
@@ -3430,7 +3430,7 @@
 };
 
 /* options */
-char *ignore = NULL;
+static char *ignore = NULL;
 
 module_param(ignore, charp, 0400);
 MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
diff -Nru a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
--- a/drivers/ide/ide-cd.h 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/ide-cd.h 2004-11-18 00:15:00 +01:00
@@ -519,7 +519,7 @@
 
  /* The generic packet command opcodes for CD/DVD Logical Units,
  * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ 
-const struct {
+static const struct {
  unsigned short packet_command;
  const char * const text;
 } packet_command_texts[] = {
@@ -577,7 +577,7 @@
 
 
 /* From Table 303 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
-const char * const sense_key_texts[16] = {
+static const char * const sense_key_texts[16] = {
  "No sense data",
  "Recovered error",
  "Not ready",
@@ -597,7 +597,7 @@
 };
 
 /* From Table 304 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
-const struct {
+static const struct {
  unsigned long asc_ascq;
  const char * const text;
 } sense_data_texts[] = {
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/ide-disk.c 2004-11-18 00:15:00 +01:00
@@ -390,7 +390,7 @@
  return err;
 }
 
-ide_startstop_t idedisk_error (ide_drive_t *drive, const char *msg, u8 stat)
+static ide_startstop_t idedisk_error (ide_drive_t *drive, const char *msg, u8 stat)
 {
  ide_hwif_t *hwif;
  struct request *rq;
@@ -450,7 +450,7 @@
  return ide_stopped;
 }
 
-ide_startstop_t idedisk_abort(ide_drive_t *drive, const char *msg)
+static ide_startstop_t idedisk_abort(ide_drive_t *drive, const char *msg)
 {
  ide_hwif_t *hwif;
  struct request *rq;
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/ide-dma.c 2004-11-18 00:15:00 +01:00
@@ -129,7 +129,6 @@
  { "CD-532E-A"  , "ALL"  },
  { "E-IDE CD-ROM CR-840", "ALL"  },
  { "CD-ROM Drive/F5A", "ALL"  },
- { "RICOH CD-R/RW MP7083A", "ALL"  },
  { "WPI CDD-820",  "ALL"  },
  { "SAMSUNG CD-ROM SC-148C", "ALL"  },
  { "SAMSUNG CD-ROM SC-148F", "ALL"  },
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/ide-probe.c 2004-11-18 00:15:00 +01:00
@@ -1149,7 +1149,7 @@
 
 extern ide_driver_t idedefault_driver;
 
-struct kobject *ata_probe(dev_t dev, int *part, void *data)
+static struct kobject *ata_probe(dev_t dev, int *part, void *data)
 {
  ide_hwif_t *hwif = data;
  int unit = *part >> PARTN_BITS;
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/ide-proc.c 2004-11-18 00:15:00 +01:00
@@ -124,6 +124,18 @@
  PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
+static void proc_ide_settings_warn(void)
+{
+ static int warned = 0;
+
+ if (warned)
+  return;
+
+ printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
+       "obsolete, and will be removed soon!\n");
+ warned = 1;
+}
+
 static int proc_ide_read_settings
  (char *page, char **start, off_t off, int count, int *eof, void *data)
 {
@@ -132,8 +144,7 @@
  char  *out = page;
  int  len, rc, mul_factor, div_factor;
 
- printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
-       "obsolete, and will be removed soon!\n");
+ proc_ide_settings_warn();
 
  down(&ide_setting_sem);
  out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
@@ -171,11 +182,10 @@
  ide_settings_t *setting;
  char *buf, *s;
 
- printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
-       "obsolete, and will be removed soon!\n");
-
  if (!capable(CAP_SYS_ADMIN))
   return -EACCES;
+
+ proc_ide_settings_warn();
 
  if (count >= PAGE_SIZE)
   return -EINVAL;
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/ide.c 2004-11-18 00:15:00 +01:00
@@ -1846,7 +1846,7 @@
 #endif /* CONFIG_BLK_DEV_IDEDOUBLER */
 
  if (!strcmp(s, "ide=nodma")) {
-  printk("IDE: Prevented DMA\n");
+  printk(" : Prevented DMA\n");
   noautodma = 1;
   return 1;
  }
diff -Nru a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c
--- a/drivers/ide/legacy/hd.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/legacy/hd.c 2004-11-18 00:15:00 +01:00
@@ -174,7 +174,7 @@
 }
 #endif
 
-void __init hd_setup(char *str, int *ints)
+static void __init hd_setup(char *str, int *ints)
 {
  int hdind = 0;
 
@@ -239,7 +239,7 @@
 #endif
 }
 
-void check_status(void)
+static void check_status(void)
 {
  int i = inb_p(HD_STATUS);
 
@@ -386,7 +386,7 @@
  * drive enters "idle", "standby", or "sleep" mode, so if the status looks
  * "good", we just ignore the interrupt completely.
  */
-void unexpected_hd_interrupt(void)
+static void unexpected_hd_interrupt(void)
 {
  unsigned int stat = inb_p(HD_STATUS);
 
@@ -551,7 +551,7 @@
  enable_irq(HD_IRQ);
 }
 
-int do_special_op(struct hd_i_struct *disk, struct request *req)
+static int do_special_op(struct hd_i_struct *disk, struct request *req)
 {
 	if (disk->recalibrate) {
 		disk->recalibrate = 0;
diff -Nru a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
--- a/drivers/ide/legacy/qd65xx.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/legacy/qd65xx.c 2004-11-18 00:15:00 +01:00
@@ -101,7 +101,7 @@
  spin_unlock_irqrestore(&ide_lock, flags);
 }
 
-u8 __init qd_read_reg (unsigned long reg)
+static u8 __init qd_read_reg (unsigned long reg)
 {
  unsigned long flags;
  u8 read;
diff -Nru a/drivers/ide/legacy/qd65xx.h b/drivers/ide/legacy/qd65xx.h
--- a/drivers/ide/legacy/qd65xx.h 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/legacy/qd65xx.h 2004-11-18 00:15:00 +01:00
@@ -46,7 +46,7 @@
 
 /* Drive specific timing taken from DOS driver v3.7 */
 
-struct qd65xx_timing_s {
+static struct qd65xx_timing_s {
  s8 offset;   /* ofset from the beginning of Model Number" */
  char model[4];    /* 4 chars from Model number, no conversion */
  s16 active;   /* active time */
diff -Nru a/drivers/ide/pci/aec62xx.h b/drivers/ide/pci/aec62xx.h
--- a/drivers/ide/pci/aec62xx.h 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/aec62xx.h 2004-11-18 00:15:00 +01:00
@@ -11,7 +11,7 @@
  byte  ultra_settings;
 };
 
-struct chipset_bus_clock_list_entry aec6xxx_33_base [] = {
+static struct chipset_bus_clock_list_entry aec6xxx_33_base [] = {
  { XFER_UDMA_6, 0x31, 0x07 },
  { XFER_UDMA_5, 0x31, 0x06 },
  { XFER_UDMA_4, 0x31, 0x05 },
@@ -31,7 +31,7 @@
  { 0,  0x00, 0x00 }
 };
 
-struct chipset_bus_clock_list_entry aec6xxx_34_base [] = {
+static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = {
  { XFER_UDMA_6, 0x41, 0x06 },
  { XFER_UDMA_5, 0x41, 0x05 },
  { XFER_UDMA_4, 0x41, 0x04 },
diff -Nru a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
--- a/drivers/ide/pci/cs5520.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/cs5520.c 2004-11-18 00:15:00 +01:00
@@ -58,7 +58,7 @@
  int recovery;
 };
 
-struct pio_clocks cs5520_pio_clocks[]={
+static struct pio_clocks cs5520_pio_clocks[]={
  {3, 6, 11},
  {2, 5, 6},
  {1, 4, 3},
diff -Nru a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
--- a/drivers/ide/pci/cy82c693.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/cy82c693.c 2004-11-18 00:15:00 +01:00
@@ -183,7 +183,7 @@
 /* 
  * used to set DMA mode for CY82C693 (single and multi modes)
  */
-int cy82c693_ide_dma_on (ide_drive_t *drive)
+static int cy82c693_ide_dma_on (ide_drive_t *drive)
 {
  struct hd_driveid *id = drive->id;
 
diff -Nru a/drivers/ide/pci/hpt366.h b/drivers/ide/pci/hpt366.h
--- a/drivers/ide/pci/hpt366.h 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/hpt366.h 2004-11-18 00:15:00 +01:00
@@ -10,7 +10,7 @@
 #undef HPT_DELAY_INTERRUPT
 #undef HPT_SERIALIZE_IO
 
-const char *quirk_drives[] = {
+static const char *quirk_drives[] = {
  "QUANTUM FIREBALLlct08 08",
  "QUANTUM FIREBALLP KA6.4",
  "QUANTUM FIREBALLP LM20.4",
@@ -18,7 +18,7 @@
         NULL
 };
 
-const char *bad_ata100_5[] = {
+static const char *bad_ata100_5[] = {
  "IBM-DTLA-307075",
  "IBM-DTLA-307060",
  "IBM-DTLA-307045",
@@ -37,7 +37,7 @@
  NULL
 };
 
-const char *bad_ata66_4[] = {
+static const char *bad_ata66_4[] = {
  "IBM-DTLA-307075",
  "IBM-DTLA-307060",
  "IBM-DTLA-307045",
@@ -56,12 +56,12 @@
  NULL
 };
 
-const char *bad_ata66_3[] = {
+static const char *bad_ata66_3[] = {
  "WDC AC310200R",
  NULL
 };
 
-const char *bad_ata33[] = {
+static const char *bad_ata33[] = {
  "Maxtor 92720U8", "Maxtor 92040U6", "Maxtor 91360U4", "Maxtor 91020U3", "Maxtor 90845U3", "Maxtor 90650U2",
  "Maxtor 91360D8", "Maxtor 91190D7", "Maxtor 91020D6", "Maxtor 90845D5", "Maxtor 90680D4", "Maxtor 90510D3", "Maxtor 90340D2",
  "Maxtor 91152D8", "Maxtor 91008D7", "Maxtor 90845D6", "Maxtor 90840D6", "Maxtor 90720D5", "Maxtor 90648D5", "Maxtor 90576D4",
@@ -99,7 +99,7 @@
  *        PIO.
  * 31     FIFO enable.
  */
-struct chipset_bus_clock_list_entry forty_base_hpt366[] = {
+static struct chipset_bus_clock_list_entry forty_base_hpt366[] = {
  { XFER_UDMA_4, 0x900fd943 },
  { XFER_UDMA_3, 0x900ad943 },
  { XFER_UDMA_2, 0x900bd943 },
@@ -118,7 +118,7 @@
  { 0,  0x0120d9d9 }
 };
 
-struct chipset_bus_clock_list_entry thirty_three_base_hpt366[] = {
+static struct chipset_bus_clock_list_entry thirty_three_base_hpt366[] = {
  { XFER_UDMA_4, 0x90c9a731 },
  { XFER_UDMA_3, 0x90cfa731 },
  { XFER_UDMA_2, 0x90caa731 },
@@ -137,7 +137,7 @@
  { 0,  0x0120a7a7 }
 };
 
-struct chipset_bus_clock_list_entry twenty_five_base_hpt366[] = {
+static struct chipset_bus_clock_list_entry twenty_five_base_hpt366[] = {
 
  { XFER_UDMA_4, 0x90c98521 },
  { XFER_UDMA_3, 0x90cf8521 },
@@ -158,7 +158,7 @@
 };
 
 /* from highpoint documentation. these are old values */
-struct chipset_bus_clock_list_entry thirty_three_base_hpt370[] = {
+static struct chipset_bus_clock_list_entry thirty_three_base_hpt370[] = {
 /* { XFER_UDMA_5, 0x1A85F442, 0x16454e31 }, */
  { XFER_UDMA_5, 0x16454e31 },
  { XFER_UDMA_4, 0x16454e31 },
@@ -179,7 +179,7 @@
  { 0,  0x06514e57 }
 };
 
-struct chipset_bus_clock_list_entry sixty_six_base_hpt370[] = {
+static struct chipset_bus_clock_list_entry sixty_six_base_hpt370[] = {
  {       XFER_UDMA_5,    0x14846231      },
  {       XFER_UDMA_4,    0x14886231      },
  {       XFER_UDMA_3,    0x148c6231      },
@@ -200,7 +200,7 @@
 };
 
 /* these are the current (4 sep 2001) timings from highpoint */
-struct chipset_bus_clock_list_entry thirty_three_base_hpt370a[] = {
+static struct chipset_bus_clock_list_entry thirty_three_base_hpt370a[] = {
         {       XFER_UDMA_5,    0x12446231      },
         {       XFER_UDMA_4,    0x12446231      },
         {       XFER_UDMA_3,    0x126c6231      },
@@ -221,7 +221,7 @@
 };
 
 /* 2x 33MHz timings */
-struct chipset_bus_clock_list_entry sixty_six_base_hpt370a[] = {
+static struct chipset_bus_clock_list_entry sixty_six_base_hpt370a[] = {
  {       XFER_UDMA_5,    0x1488e673       },
  {       XFER_UDMA_4,    0x1488e673       },
  {       XFER_UDMA_3,    0x1498e673       },
@@ -241,7 +241,7 @@
  {       0,              0x0d02bf5f       }
 };
 
-struct chipset_bus_clock_list_entry fifty_base_hpt370a[] = {
+static struct chipset_bus_clock_list_entry fifty_base_hpt370a[] = {
  {       XFER_UDMA_5,    0x12848242      },
  {       XFER_UDMA_4,    0x12ac8242      },
  {       XFER_UDMA_3,    0x128c8242      },
@@ -261,7 +261,7 @@
  {       0,              0x0ac1f48a      }
 };
 
-struct chipset_bus_clock_list_entry thirty_three_base_hpt372[] = {
+static struct chipset_bus_clock_list_entry thirty_three_base_hpt372[] = {
  { XFER_UDMA_6, 0x1c81dc62 },
  { XFER_UDMA_5, 0x1c6ddc62 },
  { XFER_UDMA_4, 0x1c8ddc62 },
@@ -282,7 +282,7 @@
  { 0,  0x0d029d5e }
 };
 
-struct chipset_bus_clock_list_entry fifty_base_hpt372[] = {
+static struct chipset_bus_clock_list_entry fifty_base_hpt372[] = {
  { XFER_UDMA_5, 0x12848242 },
  { XFER_UDMA_4, 0x12ac8242 },
  { XFER_UDMA_3, 0x128c8242 },
@@ -302,7 +302,7 @@
  { 0,  0x0a81f443 }
 };
 
-struct chipset_bus_clock_list_entry sixty_six_base_hpt372[] = {
+static struct chipset_bus_clock_list_entry sixty_six_base_hpt372[] = {
  { XFER_UDMA_6, 0x1c869c62 },
  { XFER_UDMA_5, 0x1cae9c62 },
  { XFER_UDMA_4, 0x1c8a9c62 },
@@ -323,7 +323,7 @@
  { 0,  0x0d029d26 }
 };
 
-struct chipset_bus_clock_list_entry thirty_three_base_hpt374[] = {
+static struct chipset_bus_clock_list_entry thirty_three_base_hpt374[] = {
  { XFER_UDMA_6, 0x12808242 },
  { XFER_UDMA_5, 0x12848242 },
  { XFER_UDMA_4, 0x12ac8242 },
@@ -345,7 +345,7 @@
 };
 
 #if 0
-struct chipset_bus_clock_list_entry fifty_base_hpt374[] = {
+static struct chipset_bus_clock_list_entry fifty_base_hpt374[] = {
  { XFER_UDMA_6, },
  { XFER_UDMA_5, },
  { XFER_UDMA_4, },
@@ -365,7 +365,7 @@
 };
 #endif
 #if 0
-struct chipset_bus_clock_list_entry sixty_six_base_hpt374[] = {
+static struct chipset_bus_clock_list_entry sixty_six_base_hpt374[] = {
  { XFER_UDMA_6, 0x12406231 }, /* checkme */
  { XFER_UDMA_5, 0x12446231 },
     0x14846231
diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
--- a/drivers/ide/pci/pdc202xx_new.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/pdc202xx_new.c 2004-11-18 00:15:00 +01:00
@@ -234,62 +234,6 @@
   HWIF(drive)->channel ? "Secondary" : "Primary");
 }
 
-static void pdcnew_reset_host (ide_hwif_t *hwif)
-{
-// unsigned long high_16 = hwif->dma_base - (8*(hwif->channel));
- unsigned long high_16 = hwif->dma_master;
- u8 udma_speed_flag = hwif->INB(high_16|0x001f);
-
- hwif->OUTB((udma_speed_flag | 0x10), (high_16|0x001f));
- mdelay(100);
- hwif->OUTB((udma_speed_flag & ~0x10), (high_16|0x001f));
- mdelay(2000); /* 2 seconds ?! */
-
- printk(KERN_WARNING "PDC202XX: %s channel reset.\n",
-  hwif->channel ? "Secondary" : "Primary");
-}
-
-void pdcnew_reset (ide_drive_t *drive)
-{
- ide_hwif_t *hwif = HWIF(drive);
- ide_hwif_t *mate = hwif->mate;
- 
- pdcnew_reset_host(hwif);
- pdcnew_reset_host(mate);
-#if 0
- /*
-  * FIXME: Have to kick all the drives again :-/
-  * What a pain in the ACE!
-  */
- if (hwif->present) {
-  u16 hunit = 0;
-  for (hunit = 0; hunit < MAX_DRIVES; ++hunit) {
-   ide_drive_t *hdrive = &hwif->drives[hunit];
-   if (hdrive->present) {
-    if (hwif->ide_dma_check)
-     hwif->ide_dma_check(hdrive);
-    else
-     hwif->tuneproc(hdrive, 5);
-   }
-  }
- }
- if (mate->present) {
-  u16 munit = 0;
-  for (munit = 0; munit < MAX_DRIVES; ++munit) {
-   ide_drive_t *mdrive = &mate->drives[munit];
-   if (mdrive->present) {
-    if (mate->ide_dma_check) 
-     mate->ide_dma_check(mdrive);
-    else
-     mate->tuneproc(mdrive, 5);
-   }
-  }
- }
-#else
- hwif->tuneproc(drive, 5);
-#endif
-}
-
 #ifdef CONFIG_PPC_PMAC
 static void __devinit apple_kiwi_init(struct pci_dev *pdev)
 {
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/pdc202xx_old.c 2004-11-18 00:15:00 +01:00
@@ -457,7 +457,7 @@
   hwif->channel ? "Secondary" : "Primary");
 }
 
-void pdc202xx_reset (ide_drive_t *drive)
+static void pdc202xx_reset (ide_drive_t *drive)
 {
  ide_hwif_t *hwif = HWIF(drive);
  ide_hwif_t *mate = hwif->mate;
diff -Nru a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
--- a/drivers/ide/pci/sc1200.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/sc1200.c 2004-11-18 00:15:00 +01:00
@@ -72,7 +72,7 @@
 /*
  * Set a new transfer mode at the drive
  */
-int sc1200_set_xfer_mode (ide_drive_t *drive, byte mode)
+static int sc1200_set_xfer_mode (ide_drive_t *drive, byte mode)
 {
  printk("%s: sc1200_set_xfer_mode(%s)\n", drive->name, ide_xfer_verbose(mode));
  return ide_config_drive_speed(drive, mode);
@@ -263,7 +263,7 @@
  *
  *  returns 1 on error, 0 otherwise
  */
-int sc1200_ide_dma_end (ide_drive_t *drive)
+static int sc1200_ide_dma_end (ide_drive_t *drive)
 {
  ide_hwif_t *hwif = HWIF(drive);
  unsigned long dma_base = hwif->dma_base;
diff -Nru a/drivers/ide/pci/serverworks.h b/drivers/ide/pci/serverworks.h
--- a/drivers/ide/pci/serverworks.h 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/serverworks.h 2004-11-18 00:15:00 +01:00
@@ -13,7 +13,7 @@
 
 /* Seagate Barracuda ATA IV Family drives in UDMA mode 5
  * can overrun their FIFOs when used with the CSB5 */
-const char *svwks_bad_ata100[] = {
+static const char *svwks_bad_ata100[] = {
  "ST320011A",
  "ST340016A",
  "ST360021A",
diff -Nru a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
--- a/drivers/ide/pci/trm290.c 2004-11-18 00:15:00 +01:00
+++ b/drivers/ide/pci/trm290.c 2004-11-18 00:15:00 +01:00
@@ -249,7 +249,7 @@
 /*
  * Invoked from ide-dma.c at boot time.
  */
-void __devinit init_hwif_trm290(ide_hwif_t *hwif)
+static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
 {
  unsigned int cfgbase = 0;
  unsigned long flags;

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-11-06  0:54 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-11-06  0:54 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi Linus!

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/ide-probe.c     |   63 +++++++++++++++++++++++++--------
 drivers/ide/ide.c           |   14 +++++--
 drivers/ide/legacy/ide-cs.c |    2 -
 drivers/ide/pci/cs5520.c    |    2 -
 drivers/ide/pci/ns87415.c   |   83 +++++++++++++++++++++++++++++++++++++++++---
 drivers/ide/pci/siimage.c   |   54 ++++++++++++++++------------
 drivers/ide/setup-pci.c     |    4 +-
 include/linux/ata.h         |    8 +++-
 include/linux/hdreg.h       |   23 +-----------
 include/linux/ide.h         |   31 ++--------------
 10 files changed, 186 insertions(+), 98 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/11/06 1.2474)
   [ide] siimage: fix the various SI3112 hangs
   
   From: Alan Cox <alan@lxorguk.ukuu.org.uk>
   (some changes by me - bart)
   
   The current driver looks at fields before it is safe to, we move the
   mod15rm bug handler to be a fixup and this ensures the probe has been
   completed before we use the ident data.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/06 1.2473)
   [ide] apply undecoded slave fixup only for ide-cs
   
   From: Alan Cox <alan@lxorguk.ukuu.org.uk>
   (some changes by me - bart)
   
   We add probe_hwif_init_with_fixup (seperate naming as requested by
   Bartlomiej). This runs a fixup on present interfaces before attaching
   the drives. In order to be useful we need also an _with_fixup version
   of ide_register_hw function. 
   
   The sometimes troublesome undecoded slave detector is moved to its own
   function and exported so that ide-cs and the upcoming delkin_cb can both
   use it (along with any arch specific cf/pcmcia drivers I don't know
   about). The non-relevant checks for this scenario are removed.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/05 1.2472)
   [ide] remove debugging delay from CS5520 driver
   
   From: Alan Cox <alan@lxorguk.ukuu.org.uk>
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/05 1.2471)
   [ide] (partially) unify hdreg.h & ata.h
   
   Signed-off-by: Chris Wedgwood <cw@f00f.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/05 1.2470)
   [ide] remove some cruft from ide.h
   
   From: Chris Wedgwood <cw@f00f.org>
   (minor changes by me - bart)
   
   Remove some accumulated (unused) cruft from ide.h
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/05 1.2469)
   [ide] ns87415: small cleanup
   
   ide_hwif_setup_dma() calls pci_set_master() if necessary.
   pci_set_master() (indirectly via pcibios_set_master()) sets
   PCI_LATENCY_TIMER to a "reasonable" value.
   
   Signed-off-by: Grant Grundler <grundler@parisc-linux.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/05 1.2468)
   [ide] ns87415: PA-RISC update
   
   From: Grant Grundler <grundler@parisc-linux.org>
   (minor changes by me - bart)
   
   Move Superio (NatSem 87560) IDE hacks into the ns87415 driver
   instead of exporting IDE data structures.
   
   To date, only PA-RISC port is known to use the 87560 chip.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/05 1.2467)
   [ide] shrink hw_regs_t
   
   sata_[misc,scr] and priv are write-only
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	2004-11-06 01:28:50 +01:00
+++ b/drivers/ide/ide-probe.c	2004-11-06 01:28:50 +01:00
@@ -652,6 +652,43 @@
 	return rc;
 }
 
+/**
+ *	ide_undecoded_slave	-	look for bad CF adapters
+ *	@hwif: interface
+ *
+ *	Analyse the drives on the interface and attempt to decide if we
+ *	have the same drive viewed twice. This occurs with crap CF adapters
+ *	and PCMCIA sometimes.
+ */
+
+void ide_undecoded_slave(ide_hwif_t *hwif)
+{
+	ide_drive_t *drive0 = &hwif->drives[0];
+	ide_drive_t *drive1 = &hwif->drives[1];
+
+	if (drive0->present == 0 || drive1->present == 0)
+		return;
+
+	/* If the models don't match they are not the same product */
+	if (strcmp(drive0->id->model, drive1->id->model))
+		return;
+
+	/* Serial numbers do not match */
+	if (strncmp(drive0->id->serial_no, drive1->id->serial_no, 20))
+		return;
+
+	/* No serial number, thankfully very rare for CF */
+	if (drive0->id->serial_no[0] == 0)
+		return;
+
+	/* Appears to be an IDE flash adapter with decode bugs */
+	printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n");
+
+	drive1->present = 0;
+}
+
+EXPORT_SYMBOL_GPL(ide_undecoded_slave);
+
 /*
  * This routine only knows how to look for drive units 0 and 1
  * on an interface, so any setting of MAX_DRIVES > 2 won't work here.
@@ -723,20 +760,6 @@
 		ide_drive_t *drive = &hwif->drives[unit];
 		drive->dn = (hwif->channel ? 2 : 0) + unit;
 		(void) probe_for_drive(drive);
-		if (drive->present && hwif->present && unit == 1) {
-			if (strcmp(hwif->drives[0].id->model, drive->id->model) == 0 &&
-			    /* Don't do this for noprobe or non ATA */
-			    strcmp(drive->id->model, "UNKNOWN") &&
-			    /* And beware of confused Maxtor drives that go "M0000000000"
-			      "The SN# is garbage in the ID block..." [Eric] */
-			    strncmp(drive->id->serial_no, "M0000000000000000000", 20) &&
-			    /* Same goes for another set of Maxtor drives that say "D3000000" */
-			    strncmp(drive->id->serial_no, "D3000000", 8) &&
-			    strncmp(hwif->drives[0].id->serial_no, drive->id->serial_no, 20) == 0) {
-				printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n");
-				drive->present = 0;
-			}
-		}
 		if (drive->present && !hwif->present) {
 			hwif->present = 1;
 			if (hwif->chipset != ide_4drives ||
@@ -810,9 +833,14 @@
 }
 
 static int hwif_init(ide_hwif_t *hwif);
-int probe_hwif_init (ide_hwif_t *hwif)
+
+int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
 {
 	probe_hwif(hwif);
+
+	if (fixup)
+		fixup(hwif);
+
 	hwif_init(hwif);
 
 	if (hwif->present) {
@@ -828,6 +856,11 @@
 		}
 	}
 	return 0;
+}
+
+int probe_hwif_init(ide_hwif_t *hwif)
+{
+	return probe_hwif_init_with_fixup(hwif, NULL);
 }
 
 EXPORT_SYMBOL(probe_hwif_init);
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2004-11-06 01:28:50 +01:00
+++ b/drivers/ide/ide.c	2004-11-06 01:28:50 +01:00
@@ -985,9 +985,10 @@
 }
 
 /**
- *	ide_register_hw		-	register IDE interface
+ *	ide_register_hw_with_fixup	-	register IDE interface
  *	@hw: hardware registers
  *	@hwifp: pointer to returned hwif
+ *	@fixup: fixup function
  *
  *	Register an IDE interface, specifying exactly the registers etc.
  *	Set init=1 iff calling before probes have taken place.
@@ -995,7 +996,7 @@
  *	Returns -1 on error.
  */
 
-int ide_register_hw (hw_regs_t *hw, ide_hwif_t **hwifp)
+int ide_register_hw_with_fixup(hw_regs_t *hw, ide_hwif_t **hwifp, void(*fixup)(ide_hwif_t *hwif))
 {
 	int index, retry = 1;
 	ide_hwif_t *hwif;
@@ -1034,7 +1035,7 @@
 	hwif->chipset = hw->chipset;
 
 	if (!initializing) {
-		probe_hwif_init(hwif);
+		probe_hwif_init_with_fixup(hwif, fixup);
 		create_proc_ide_interfaces();
 	}
 
@@ -1042,6 +1043,13 @@
 		*hwifp = hwif;
 
 	return (initializing || hwif->present) ? index : -1;
+}
+
+EXPORT_SYMBOL(ide_register_hw_with_fixup);
+
+int ide_register_hw(hw_regs_t *hw, ide_hwif_t **hwifp)
+{
+	return ide_register_hw_with_fixup(hw, hwifp, NULL);
 }
 
 EXPORT_SYMBOL(ide_register_hw);
diff -Nru a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
--- a/drivers/ide/legacy/ide-cs.c	2004-11-06 01:28:50 +01:00
+++ b/drivers/ide/legacy/ide-cs.c	2004-11-06 01:28:50 +01:00
@@ -206,7 +206,7 @@
     ide_init_hwif_ports(&hw, io, ctl, NULL);
     hw.irq = irq;
     hw.chipset = ide_pci;
-    return ide_register_hw(&hw, NULL);
+    return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave);
 }
 
 /*======================================================================
diff -Nru a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
--- a/drivers/ide/pci/cs5520.c	2004-11-06 01:28:50 +01:00
+++ b/drivers/ide/pci/cs5520.c	2004-11-06 01:28:50 +01:00
@@ -241,8 +241,6 @@
 
 	ide_pci_setup_ports(dev, d, 14, &index);
 
-	printk("Index.b %d %d\n", index.b.low, index.b.high);
-	mdelay(2000);
 	if((index.b.low & 0xf0) != 0xf0)
 		probe_hwif_init(&ide_hwifs[index.b.low]);
 	if((index.b.high & 0xf0) != 0xf0)
diff -Nru a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
--- a/drivers/ide/pci/ns87415.c	2004-11-06 01:28:50 +01:00
+++ b/drivers/ide/pci/ns87415.c	2004-11-06 01:28:50 +01:00
@@ -4,6 +4,7 @@
  * Copyright (C) 1997-1998	Mark Lord <mlord@pobox.com>
  * Copyright (C) 1998		Eddie C. Dost <ecd@skynet.be>
  * Copyright (C) 1999-2000	Andre Hedrick <andre@linux-ide.org>
+ * Copyright (C) 2004		Grant Grundler <grundler at parisc-linux.org>
  *
  * Inspired by an earlier effort from David S. Miller <davem@redhat.com>
  */
@@ -25,6 +26,81 @@
 
 #include <asm/io.h>
 
+#ifdef CONFIG_SUPERIO
+/* SUPERIO 87560 is a PoS chip that NatSem denies exists.
+ * Unfortunately, it's built-in on all Astro-based PA-RISC workstations
+ * which use the integrated NS87514 cell for CD-ROM support.
+ * i.e we have to support for CD-ROM installs.
+ * See drivers/parisc/superio.c for more gory details.
+ */
+#include <asm/superio.h>
+
+static unsigned long superio_ide_status[2];
+static unsigned long superio_ide_select[2];
+static unsigned long superio_ide_dma_status[2];
+
+#define SUPERIO_IDE_MAX_RETRIES 25
+
+/* Because of a defect in Super I/O, all reads of the PCI DMA status 
+ * registers, IDE status register and the IDE select register need to be 
+ * retried
+ */
+static u8 superio_ide_inb (unsigned long port)
+{
+	if (port == superio_ide_status[0] ||
+	    port == superio_ide_status[1] ||
+	    port == superio_ide_select[0] ||
+	    port == superio_ide_select[1] ||
+	    port == superio_ide_dma_status[0] ||
+	    port == superio_ide_dma_status[1]) {
+		u8 tmp;
+		int retries = SUPERIO_IDE_MAX_RETRIES;
+
+		/* printk(" [ reading port 0x%x with retry ] ", port); */
+
+		do {
+			tmp = inb(port);
+			if (tmp == 0)
+				udelay(50);
+		} while (tmp == 0 && retries-- > 0);
+
+		return tmp;
+	}
+
+	return inb(port);
+}
+
+static void __devinit superio_ide_init_iops (struct hwif_s *hwif)
+{
+	u32 base, dmabase;
+	u8 tmp;
+	struct pci_dev *pdev = hwif->pci_dev;
+	u8 port = hwif->channel;
+
+	base = pci_resource_start(pdev, port * 2) & ~3;
+	dmabase = pci_resource_start(pdev, 4) & ~3;
+
+	superio_ide_status[port] = base + IDE_STATUS_OFFSET;
+	superio_ide_select[port] = base + IDE_SELECT_OFFSET;
+	superio_ide_dma_status[port] = dmabase + (!port ? 2 : 0xa);
+
+	/* Clear error/interrupt, enable dma */
+	tmp = superio_ide_inb(superio_ide_dma_status[port]);
+	outb(tmp | 0x66, superio_ide_dma_status[port]);
+
+	/* We need to override inb to workaround a SuperIO errata */
+	hwif->INB = superio_ide_inb;
+}
+
+static void __devinit init_iops_ns87415(ide_hwif_t *hwif)
+{
+	if (PCI_SLOT(hwif->pci_dev->devfn) == 0xE) {
+		/* Built-in - assume it's under superio. */
+		superio_ide_init_iops(hwif);
+	}
+}
+#endif
+
 static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 };
 
 /*
@@ -132,10 +208,6 @@
 	hwif->autodma = 0;
 	hwif->selectproc = &ns87415_selectproc;
 
-	/* Set a good latency timer and cache line size value. */
-	(void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
-	/* FIXME: use pci_set_master() to ensure good latency timer value */
-
 	/*
 	 * We cannot probe for IRQ: both ports share common IRQ on INTA.
 	 * Also, leave IRQ masked during drive probing, to prevent infinite
@@ -205,6 +277,9 @@
 
 static ide_pci_device_t ns87415_chipset __devinitdata = {
 	.name		= "NS87415",
+#ifdef CONFIG_SUPERIO
+	.init_iops	= init_iops_ns87415,
+#endif
 	.init_hwif	= init_hwif_ns87415,
 	.channels	= 2,
 	.autodma	= AUTODMA,
diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
--- a/drivers/ide/pci/siimage.c	2004-11-06 01:28:50 +01:00
+++ b/drivers/ide/pci/siimage.c	2004-11-06 01:28:50 +01:00
@@ -871,12 +871,11 @@
 	 *	the MMIO layout isnt the same as the the standard port
 	 *	based I/O
 	 */
-	 
+
 	memset(&hw, 0, sizeof(hw_regs_t));
-	hw.priv				= addr;
 
-	base				= (unsigned long)addr;
-	if(ch)
+	base = (unsigned long)addr;
+	if (ch)
 		base += 0xC0;
 	else
 		base += 0x80;
@@ -901,16 +900,16 @@
 
 	hw.io_ports[IDE_IRQ_OFFSET]	= 0;
 
-        if (pdev_is_sata(dev)) {
-        	base = (unsigned long) addr;
-        	if(ch)
-        		base += 0x80;
-		hw.sata_scr[SATA_STATUS_OFFSET]	= base + 0x104;
-		hw.sata_scr[SATA_ERROR_OFFSET]	= base + 0x108;
-		hw.sata_scr[SATA_CONTROL_OFFSET]= base + 0x100;
-		hw.sata_misc[SATA_MISC_OFFSET]	= base + 0x140;
-		hw.sata_misc[SATA_PHY_OFFSET]	= base + 0x144;
-		hw.sata_misc[SATA_IEN_OFFSET]	= base + 0x148;
+	if (pdev_is_sata(dev)) {
+		base = (unsigned long)addr;
+		if (ch)
+			base += 0x80;
+		hwif->sata_scr[SATA_STATUS_OFFSET]	= base + 0x104;
+		hwif->sata_scr[SATA_ERROR_OFFSET]	= base + 0x108;
+		hwif->sata_scr[SATA_CONTROL_OFFSET]	= base + 0x100;
+		hwif->sata_misc[SATA_MISC_OFFSET]	= base + 0x140;
+		hwif->sata_misc[SATA_PHY_OFFSET]	= base + 0x144;
+		hwif->sata_misc[SATA_IEN_OFFSET]	= base + 0x148;
 	}
 
 	hw.irq				= hwif->pci_dev->irq;
@@ -918,11 +917,6 @@
 	memcpy(&hwif->hw, &hw, sizeof(hw));
 	memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
 
-	if (is_sata(hwif)) {
-		memcpy(hwif->sata_scr, hwif->hw.sata_scr, sizeof(hwif->hw.sata_scr));
-		memcpy(hwif->sata_misc, hwif->hw.sata_misc, sizeof(hwif->hw.sata_misc));
-	}
-
 	hwif->irq			= hw.irq;
 
        	base = (unsigned long) addr;
@@ -961,6 +955,22 @@
 }
 
 /**
+ *	siimage_fixup		-	post probe fixups
+ *	@hwif: interface to fix up
+ *
+ *	Called after drive probe we use this to decide whether the
+ *	Seagate fixup must be applied. This used to be in init_iops but
+ *	that can occur before we know what drives are present.
+ */
+
+static void __devinit siimage_fixup(ide_hwif_t *hwif)
+{
+	/* Try and raise the rqsize */
+	if (!is_sata(hwif) || !is_dev_seagate_sata(&hwif->drives[0]))
+		hwif->rqsize = 128;
+}
+
+/**
  *	init_iops_siimage	-	set up iops
  *	@hwif: interface to set up
  *
@@ -980,9 +990,8 @@
 	
 	hwif->hwif_data = NULL;
 
-	hwif->rqsize = 128;
-	if (is_sata(hwif) && is_dev_seagate_sata(&hwif->drives[0]))
-		hwif->rqsize = 15;
+	/* Pessimal until we finish probing */
+	hwif->rqsize = 15;
 
 	if (pci_get_drvdata(dev) == NULL)
 		return;
@@ -1070,6 +1079,7 @@
 		.init_chipset	= init_chipset_siimage,	\
 		.init_iops	= init_iops_siimage,	\
 		.init_hwif	= init_hwif_siimage,	\
+		.fixup		= siimage_fixup,	\
 		.channels	= 2,			\
 		.autodma	= AUTODMA,		\
 		.bootable	= ON_BOARD,		\
diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
--- a/drivers/ide/setup-pci.c	2004-11-06 01:28:50 +01:00
+++ b/drivers/ide/setup-pci.c	2004-11-06 01:28:50 +01:00
@@ -707,9 +707,9 @@
 	ata_index_t index_list = do_ide_setup_pci_device(dev, d, 1);
 
 	if ((index_list.b.low & 0xf0) != 0xf0)
-		probe_hwif_init(&ide_hwifs[index_list.b.low]);
+		probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.low], d->fixup);
 	if ((index_list.b.high & 0xf0) != 0xf0)
-		probe_hwif_init(&ide_hwifs[index_list.b.high]);
+		probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.high], d->fixup);
 
 	create_proc_ide_interfaces();
 }
diff -Nru a/include/linux/ata.h b/include/linux/ata.h
--- a/include/linux/ata.h	2004-11-06 01:28:50 +01:00
+++ b/include/linux/ata.h	2004-11-06 01:28:50 +01:00
@@ -33,8 +33,6 @@
 	ATA_MAX_DEVICES		= 2,	/* per bus/port */
 	ATA_MAX_PRD		= 256,	/* we could make these 256/256 */
 	ATA_SECT_SIZE		= 512,
-	ATA_SECT_SIZE_MASK	= (ATA_SECT_SIZE - 1),
-	ATA_SECT_DWORDS		= ATA_SECT_SIZE / sizeof(u32),
 
 	ATA_ID_WORDS		= 256,
 	ATA_ID_PROD_OFS		= 27,
@@ -142,6 +140,12 @@
 	XFER_PIO_2		= 0x0A,
 	XFER_PIO_1		= 0x09,
 	XFER_PIO_0		= 0x08,
+
+	/* legacy IDE 'stuff' */
+	XFER_SW_DMA_2		= 0x12,
+	XFER_SW_DMA_1		= 0x11,
+	XFER_SW_DMA_0		= 0x10,
+	XFER_PIO_SLOW		= 0x00,
 
 	/* ATAPI stuff */
 	ATAPI_PKT_DMA		= (1 << 0),
diff -Nru a/include/linux/hdreg.h b/include/linux/hdreg.h
--- a/include/linux/hdreg.h	2004-11-06 01:28:50 +01:00
+++ b/include/linux/hdreg.h	2004-11-06 01:28:50 +01:00
@@ -1,6 +1,8 @@
 #ifndef _LINUX_HDREG_H
 #define _LINUX_HDREG_H
 
+#include <linux/ata.h>
+
 /*
  * This file contains some defines for the AT-hd-controller.
  * Various sources.
@@ -328,27 +330,6 @@
 /* WIN_SETFEATURES sub-commands */
 #define SETFEATURES_EN_8BIT	0x01	/* Enable 8-Bit Transfers */
 #define SETFEATURES_EN_WCACHE	0x02	/* Enable write cache */
-#define SETFEATURES_XFER	0x03	/* Set transfer mode */
-#	define XFER_UDMA_7	0x47	/* 0100|0111 */
-#	define XFER_UDMA_6	0x46	/* 0100|0110 */
-#	define XFER_UDMA_5	0x45	/* 0100|0101 */
-#	define XFER_UDMA_4	0x44	/* 0100|0100 */
-#	define XFER_UDMA_3	0x43	/* 0100|0011 */
-#	define XFER_UDMA_2	0x42	/* 0100|0010 */
-#	define XFER_UDMA_1	0x41	/* 0100|0001 */
-#	define XFER_UDMA_0	0x40	/* 0100|0000 */
-#	define XFER_MW_DMA_2	0x22	/* 0010|0010 */
-#	define XFER_MW_DMA_1	0x21	/* 0010|0001 */
-#	define XFER_MW_DMA_0	0x20	/* 0010|0000 */
-#	define XFER_SW_DMA_2	0x12	/* 0001|0010 */
-#	define XFER_SW_DMA_1	0x11	/* 0001|0001 */
-#	define XFER_SW_DMA_0	0x10	/* 0001|0000 */
-#	define XFER_PIO_4	0x0C	/* 0000|1100 */
-#	define XFER_PIO_3	0x0B	/* 0000|1011 */
-#	define XFER_PIO_2	0x0A	/* 0000|1010 */
-#	define XFER_PIO_1	0x09	/* 0000|1001 */
-#	define XFER_PIO_0	0x08	/* 0000|1000 */
-#	define XFER_PIO_SLOW	0x00	/* 0000|0000 */
 #define SETFEATURES_DIS_DEFECT	0x04	/* Disable Defect Management */
 #define SETFEATURES_EN_APM	0x05	/* Enable advanced power management */
 #define SETFEATURES_EN_SAME_R	0x22	/* for a region ATA-1 */
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2004-11-06 01:28:50 +01:00
+++ b/include/linux/ide.h	2004-11-06 01:28:50 +01:00
@@ -39,7 +39,6 @@
  *
  * REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary
  */
-#define REALLY_FAST_IO			/* define if ide ports are perfect */
 #define INITIAL_MULT_COUNT	0	/* off=0; on=2,4,8,16,32, etc.. */
 
 #ifndef SUPPORT_SLOW_DATA_PORTS		/* 1 to support slow data ports */
@@ -64,18 +63,6 @@
 #define IDE_NO_IRQ		(-1)
 
 /*
- * IDE_DRIVE_CMD is used to implement many features of the hdparm utility
- */
-#define IDE_DRIVE_CMD			99	/* (magic) undef to reduce kernel size*/
-
-#define IDE_DRIVE_TASK			98
-
-/*
- * IDE_DRIVE_TASKFILE is used to implement many features needed for raw tasks
- */
-#define IDE_DRIVE_TASKFILE		97
-
-/*
  *  "No user-serviceable parts" beyond this point  :)
  *****************************************************************************/
 
@@ -101,13 +88,6 @@
 
 #define DMA_PIO_RETRY	1	/* retrying in PIO */
 
-/*
- * Ensure that various configuration flags have compatible settings
- */
-#ifdef REALLY_SLOW_IO
-#undef REALLY_FAST_IO
-#endif
-
 #define HWIF(drive)		((ide_hwif_t *)((drive)->hwif))
 #define HWGROUP(drive)		((ide_hwgroup_t *)(HWIF(drive)->hwgroup))
 
@@ -197,10 +177,7 @@
 /*
  * Some more useful definitions
  */
-#define IDE_MAJOR_NAME	"hd"	/* the same for all i/f; see also genhd.c */
-#define MAJOR_NAME	IDE_MAJOR_NAME
 #define PARTN_BITS	6	/* number of minor dev bits for partitions */
-#define PARTN_MASK	((1<<PARTN_BITS)-1)	/* a useful bit mask */
 #define MAX_DRIVES	2	/* per interface; 2 assumed by lots of code */
 #define SECTOR_SIZE	512
 #define SECTOR_WORDS	(SECTOR_SIZE / 4)	/* number of 32bit words per sector */
@@ -256,16 +233,14 @@
 	int		irq;			/* our irq number */
 	int		dma;			/* our dma entry */
 	ide_ack_intr_t	*ack_intr;		/* acknowledge interrupt */
-	void		*priv;			/* interface specific data */
 	hwif_chipset_t  chipset;
-	unsigned long	sata_scr[SATA_NR_PORTS];
-	unsigned long	sata_misc[SATA_NR_PORTS];
 } hw_regs_t;
 
 /*
  * Register new hardware with ide
  */
 int ide_register_hw(hw_regs_t *hw, struct hwif_s **hwifp);
+int ide_register_hw_with_fixup(hw_regs_t *, struct hwif_s **, void (*)(struct hwif_s *));
 
 /*
  * Set up hw_regs_t structure before calling ide_register_hw (optional)
@@ -1453,6 +1428,7 @@
 	void			(*init_iops)(ide_hwif_t *);
 	void                    (*init_hwif)(ide_hwif_t *);
 	void			(*init_dma)(ide_hwif_t *, unsigned long);
+	void			(*fixup)(ide_hwif_t *);
 	u8			channels;
 	u8			autodma;
 	ide_pci_enablebit_t	enablebits[2];
@@ -1513,6 +1489,9 @@
 extern void ide_hwif_release_regions(ide_hwif_t* hwif);
 extern void ide_unregister (unsigned int index);
 
+void ide_undecoded_slave(ide_hwif_t *);
+
+int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *));
 extern int probe_hwif_init(ide_hwif_t *);
 
 static inline void *ide_get_hwifdata (ide_hwif_t * hwif)

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-11-01 18:26 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-11-01 18:26 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel


Hi Linus!

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/arm/icside.c   |    5 +++++
 drivers/ide/ide-io.c       |   37 ++++++++-----------------------------
 drivers/ide/ide-iops.c     |   16 ++++------------
 drivers/ide/ide-lib.c      |    2 --
 drivers/ide/ide-proc.c     |    6 ++++++
 drivers/ide/ide-taskfile.c |    4 +---
 drivers/ide/ide.c          |   21 ++++++++++++---------
 drivers/ide/ppc/pmac.c     |    2 --
 drivers/ide/setup-pci.c    |    5 +++++
 include/linux/ide.h        |   10 ----------
 10 files changed, 41 insertions(+), 67 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/11/01 1.2428)
   [ide] obsolete "enable DMA by default" config options
   
   CONFIG_IDEDMA_PCI_AUTO and CONFIG_IDEDMA_ICS_AUTO
   
   Host drivers should deal with broken hardware themselves.
   Warn if DMA support is enabled but "enable DMA by default" is not.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/01 1.2427)
   [ide] obsolete some command line parameters
   
   "hdx=autotune", "hdx=noautotune":
   * should be handled by host drivers needing them
   
   "idex=autotune", "idex=noautotune":
   * should die
   
   "idex=ata66":
   * should be handled by host drivers needing it
   
   "idex=dma":
   * works only for: cs5220.c, generic.c, hpt366.c, triflex.c
   * DMA should be used by default
   
   "idex=reset", "idex=serialize":
   * host drivers should set these settings when needed
   
   "idex=base[,ctl[,irq]]":
   * host drivers should auto-detect correct settings
   * ordering should be controlled by user-space
   
   "ide0=four":
   * should be handled by ide-generic driver
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/01 1.2426)
   [ide] obsolete /proc/ide/hd?/settings
   
   Majority of these settings is also available through ioctls.
   We will deal with the rest during deprecation period.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/11/01 1.2425)
   [ide] remove more dead ide exports
   
   From: Christoph Hellwig <hch@lst.de>
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
--- a/drivers/ide/arm/icside.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/arm/icside.c	2004-11-01 18:51:56 +01:00
@@ -197,6 +197,11 @@
 }
 
 #ifdef CONFIG_BLK_DEV_IDEDMA_ICS
+
+#ifndef CONFIG_IDEDMA_ICS_AUTO
+#warning CONFIG_IDEDMA_ICS_AUTO=n support is obsolete, and will be removed soon.
+#endif
+
 /*
  * SG-DMA support.
  *
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/ide-io.c	2004-11-01 18:51:56 +01:00
@@ -543,8 +543,6 @@
 	return ide_stopped;
 }
 
-EXPORT_SYMBOL(ide_error);
-
 /**
  *	ide_abort	-	abort pending IDE operatins
  *	@drive: drive the error occurred on
@@ -585,8 +583,6 @@
 	return ide_stopped;
 }
 
-EXPORT_SYMBOL(ide_abort);
-
 /**
  *	ide_cmd		-	issue a simple drive command
  *	@drive: drive the command is for
@@ -598,7 +594,8 @@
  *	The drive must be selected beforehand.
  */
 
-void ide_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, ide_handler_t *handler)
+static void ide_cmd (ide_drive_t *drive, u8 cmd, u8 nsect,
+		ide_handler_t *handler)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	if (IDE_CONTROL_REG)
@@ -608,8 +605,6 @@
 	ide_execute_command(drive, cmd, handler, WAIT_CMD, NULL);
 }
 
-EXPORT_SYMBOL(ide_cmd);
-
 /**
  *	drive_cmd_intr		- 	drive command completion interrupt
  *	@drive: drive the completion interrupt occurred on
@@ -620,7 +615,7 @@
  *	the request
  */
  
-ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
+static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
 {
 	struct request *rq = HWGROUP(drive)->rq;
 	ide_hwif_t *hwif = HWIF(drive);
@@ -645,8 +640,6 @@
 	return ide_stopped;
 }
 
-EXPORT_SYMBOL(drive_cmd_intr);
-
 /**
  *	do_special		-	issue some special commands
  *	@drive: drive the command is for
@@ -656,7 +649,7 @@
  *	back.
  */
 
-ide_startstop_t do_special (ide_drive_t *drive)
+static ide_startstop_t do_special (ide_drive_t *drive)
 {
 	special_t *s = &drive->special;
 
@@ -673,8 +666,6 @@
 		return DRIVER(drive)->special(drive);
 }
 
-EXPORT_SYMBOL(do_special);
-
 void ide_map_sg(ide_drive_t *drive, struct request *rq)
 {
 	ide_hwif_t *hwif = drive->hwif;
@@ -715,7 +706,8 @@
  *	all commands to finish. Don't do this as that is due to change
  */
 
-ide_startstop_t execute_drive_cmd (ide_drive_t *drive, struct request *rq)
+static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
+		struct request *rq)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	if (rq->flags & REQ_DRIVE_TASKFILE) {
@@ -805,8 +797,6 @@
  	return ide_stopped;
 }
 
-EXPORT_SYMBOL(execute_drive_cmd);
-
 /**
  *	start_request	-	start of I/O and command issuing for IDE
  *
@@ -818,7 +808,7 @@
  *	FIXME: this function needs a rename
  */
  
-ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
+static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
 {
 	ide_startstop_t startstop;
 	sector_t block;
@@ -909,8 +899,6 @@
 	return ide_stopped;
 }
 
-EXPORT_SYMBOL(start_request);
-
 /**
  *	ide_stall_queue		-	pause an IDE device
  *	@drive: drive to stall
@@ -1033,10 +1021,7 @@
  * the driver.  This makes the driver much more friendlier to shared IRQs
  * than previous designs, while remaining 100% (?) SMP safe and capable.
  */
-/* --BenH: made non-static as ide-pmac.c uses it to kick the hwgroup back
- *         into life on wakeup from machine sleep.
- */ 
-void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
+static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
 {
 	ide_drive_t	*drive;
 	ide_hwif_t	*hwif;
@@ -1168,8 +1153,6 @@
 	}
 }
 
-EXPORT_SYMBOL(ide_do_request);
-
 /*
  * Passes the stuff to ide_do_request
  */
@@ -1334,8 +1317,6 @@
 	spin_unlock_irqrestore(&ide_lock, flags);
 }
 
-EXPORT_SYMBOL(ide_timer_expiry);
-
 /**
  *	unexpected_intr		-	handle an unexpected IDE interrupt
  *	@irq: interrupt line
@@ -1532,8 +1513,6 @@
 	spin_unlock_irqrestore(&ide_lock, flags);
 	return IRQ_HANDLED;
 }
-
-EXPORT_SYMBOL(ide_intr);
 
 /**
  *	ide_init_drive_cmd	-	initialize a drive command request
diff -Nru a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
--- a/drivers/ide/ide-iops.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/ide-iops.c	2004-11-01 18:51:56 +01:00
@@ -673,8 +673,6 @@
 	return 0;
 }
 
-EXPORT_SYMBOL(ide_ata66_check);
-
 /*
  * Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER.
  * 1 : Safe to update drive->id DMA registers.
@@ -693,9 +691,8 @@
 	return 0;
 }
 
-EXPORT_SYMBOL(set_transfer);
-
-u8 ide_auto_reduce_xfer (ide_drive_t *drive)
+#ifdef CONFIG_BLK_DEV_IDEDMA
+static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
 {
 	if (!drive->crc_count)
 		return drive->current_speed;
@@ -719,8 +716,7 @@
 		default:		return XFER_PIO_4;
 	}
 }
-
-EXPORT_SYMBOL(ide_auto_reduce_xfer);
+#endif /* CONFIG_BLK_DEV_IDEDMA */
 
 /*
  * Update the 
@@ -795,8 +791,6 @@
 #endif
 }
 
-EXPORT_SYMBOL(ide_driveid_update);
-
 /*
  * Similar to ide_wait_stat(), except it never calls ide_error internally.
  * This is a kludge to handle the new ide_config_drive_speed() function,
@@ -936,7 +930,7 @@
  *
  * See also ide_execute_command
  */
-void __ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
+static void __ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
 		      unsigned int timeout, ide_expiry_t *expiry)
 {
 	ide_hwgroup_t *hwgroup = HWGROUP(drive);
@@ -951,8 +945,6 @@
 	hwgroup->timer.expires	= jiffies + timeout;
 	add_timer(&hwgroup->timer);
 }
-
-EXPORT_SYMBOL(__ide_set_handler);
 
 void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
 		      unsigned int timeout, ide_expiry_t *expiry)
diff -Nru a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
--- a/drivers/ide/ide-lib.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/ide-lib.c	2004-11-01 18:51:56 +01:00
@@ -421,8 +421,6 @@
 		blk_queue_bounce_limit(drive->queue, addr);
 }
 
-EXPORT_SYMBOL(ide_toggle_bounce);
-
 /**
  *	ide_set_xfer_rate	-	set transfer rate
  *	@drive: drive to set
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/ide-proc.c	2004-11-01 18:51:56 +01:00
@@ -132,6 +132,9 @@
 	char		*out = page;
 	int		len, rc, mul_factor, div_factor;
 
+	printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
+			    "obsolete, and will be removed soon!\n");
+
 	down(&ide_setting_sem);
 	out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
 	out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n");
@@ -167,6 +170,9 @@
 	unsigned long	n;
 	ide_settings_t	*setting;
 	char *buf, *s;
+
+	printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
+			    "obsolete, and will be removed soon!\n");
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
diff -Nru a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
--- a/drivers/ide/ide-taskfile.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/ide-taskfile.c	2004-11-01 18:51:56 +01:00
@@ -419,7 +419,7 @@
 /*
  * Handler for command with PIO data-out phase (Write/Write Multiple).
  */
-ide_startstop_t task_out_intr (ide_drive_t *drive)
+static ide_startstop_t task_out_intr (ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = drive->hwif;
 	struct request *rq = HWGROUP(drive)->rq;
@@ -443,8 +443,6 @@
 
 	return ide_started;
 }
-
-EXPORT_SYMBOL(task_out_intr);
 
 ide_startstop_t pre_task_out_intr (ide_drive_t *drive, struct request *rq)
 {
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/ide.c	2004-11-01 18:51:56 +01:00
@@ -1882,10 +1882,10 @@
 				goto do_serialize;
 			case -6: /* "autotune" */
 				drive->autotune = IDE_TUNE_AUTO;
-				goto done;
+				goto obsolete_option;
 			case -7: /* "noautotune" */
 				drive->autotune = IDE_TUNE_NOAUTO;
-				goto done;
+				goto obsolete_option;
 			case -9: /* "swapdata" */
 			case -10: /* "bswap" */
 				drive->bswap = 1;
@@ -2017,30 +2017,30 @@
 			case -7: /* ata66 */
 #ifdef CONFIG_BLK_DEV_IDEPCI
 				hwif->udma_four = 1;
-				goto done;
+				goto obsolete_option;
 #else
 				goto bad_hwif;
 #endif
 			case -6: /* dma */
 				hwif->autodma = 1;
-				goto done;
+				goto obsolete_option;
 			case -5: /* "reset" */
 				hwif->reset = 1;
-				goto done;
+				goto obsolete_option;
 			case -4: /* "noautotune" */
 				hwif->drives[0].autotune = IDE_TUNE_NOAUTO;
 				hwif->drives[1].autotune = IDE_TUNE_NOAUTO;
-				goto done;
+				goto obsolete_option;
 			case -3: /* "autotune" */
 				hwif->drives[0].autotune = IDE_TUNE_AUTO;
 				hwif->drives[1].autotune = IDE_TUNE_AUTO;
-				goto done;
+				goto obsolete_option;
 			case -2: /* "serialize" */
 			do_serialize:
 				hwif->mate = &ide_hwifs[hw^1];
 				hwif->mate->mate = hwif;
 				hwif->serialized = hwif->mate->serialized = 1;
-				goto done;
+				goto obsolete_option;
 
 			case -1: /* "noprobe" */
 				hwif->noprobe = 1;
@@ -2057,7 +2057,7 @@
 				hwif->irq      = vals[2];
 				hwif->noprobe  = 0;
 				hwif->chipset  = ide_forced;
-				goto done;
+				goto obsolete_option;
 
 			case 0: goto bad_option;
 			default:
@@ -2067,6 +2067,9 @@
 	}
 bad_option:
 	printk(" -- BAD OPTION\n");
+	return 1;
+obsolete_option:
+	printk(" -- OBSOLETE OPTION, WILL BE REMOVED SOON!\n");
 	return 1;
 bad_hwif:
 	printk("-- NOT SUPPORTED ON ide%d", hw);
diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
--- a/drivers/ide/ppc/pmac.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/ppc/pmac.c	2004-11-01 18:51:56 +01:00
@@ -52,8 +52,6 @@
 
 #include "ide-timing.h"
 
-extern void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq);
-
 #define IDE_PMAC_DEBUG
 
 #define DMA_WAIT_TIMEOUT	50
diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
--- a/drivers/ide/setup-pci.c	2004-11-01 18:51:56 +01:00
+++ b/drivers/ide/setup-pci.c	2004-11-01 18:51:56 +01:00
@@ -494,6 +494,11 @@
 		}
 	}
 }
+
+#ifndef CONFIG_IDEDMA_PCI_AUTO
+#warning CONFIG_IDEDMA_PCI_AUTO=n support is obsolete, and will be removed soon.
+#endif
+
 #endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/
 
 /**
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2004-11-01 18:51:56 +01:00
+++ b/include/linux/ide.h	2004-11-01 18:51:56 +01:00
@@ -1194,14 +1194,6 @@
  */
 extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
 
-/*
- * Issue a simple drive command
- * The drive must be selected beforehand.
- *
- * (drive, command, nsector, handler)
- */
-extern void ide_cmd(ide_drive_t *, u8, u8, ide_handler_t *);
-
 extern void ide_fix_driveid(struct hd_driveid *);
 /*
  * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
@@ -1366,7 +1358,6 @@
 extern ide_startstop_t task_no_data_intr(ide_drive_t *);
 extern ide_startstop_t task_in_intr(ide_drive_t *);
 extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
-extern ide_startstop_t task_out_intr(ide_drive_t *);
 
 extern int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *);
 
@@ -1376,7 +1367,6 @@
 
 extern int system_bus_clock(void);
 
-extern u8 ide_auto_reduce_xfer(ide_drive_t *);
 extern int ide_driveid_update(ide_drive_t *);
 extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
 extern int ide_config_drive_speed(ide_drive_t *, u8);

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
@ 2004-10-31  2:27 Kevin Freeman
  0 siblings, 0 replies; 53+ messages in thread
From: Kevin Freeman @ 2004-10-31  2:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: edmudama

Eric wrote:
> One of two things is happening: 
> 
> 1) Two drives are identically corrupted, producing the invalid serial
> numbers being reported in the ID block.  My belief is that this wasn't
> likely, given the low volume of reports.  The reported bad SN was
> "M0000000000000000000" which based on our firmware, I don't see how it
> could happen.  A corruption of the config sector (the most likely
> cause) *should* be catastrophic to the drive's functionality.
> 
> 2) There is a code or hardware bug somewhere outside of the drive
> itself that is causing this data to become corrupted.
> 
> Either way, I believe the best course of action is to RMA the drives
> for new ones.  I don't think good stuff will come from having the
> linux kernel use drives that appear to be broken.
> 
> It'd be nice to test these drives on more systems, or with a bus
> analyzer, to identify the cause.
> 
> --eric

I am experiencing the same problem with recent kernels.  This machine
has 2 Maxtor drives (4D080H4) with the same invalid serial number
( D4000000 ).  The machine was happily running Fedora Core 2 for quite
some time with no hard drive errors.  The drives themselves were
previously installed in a Windows XP machine, also without incident.
Note that in the current machine, Windows XP 64-bit beta Device Manager
also displays an error related to duplicate drive IDs.

System motherboard is a Chaintech VNF3-250 (NForce3). One drive is on
the onboard IDE controller, the other is attached to a Silicon Image PCI
IDE controller. Connecting both drives to the onboard IDE controller
under Linux results in the error message "ignoring undecoded slave"
and /dev/hdb is not available to the system.  Fedora kernel 2.6.8-1.521
(based on 2.6.8-rc4-bk3) was among the last to allow the system to boot
with both drives attached to the onboard IDE controller.

hdparm, dmesg output at:
http://home.comcast.net/~kfreem02/4D080H4/index.html

Please cc me on any followups.

Thanks,
Kevin Freeman


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-28 20:19     ` Eric Mudama
@ 2004-10-30 15:48       ` tabris
  0 siblings, 0 replies; 53+ messages in thread
From: tabris @ 2004-10-30 15:48 UTC (permalink / raw)
  To: Eric Mudama
  Cc: gene.heskett, linux-kernel, Alan Cox, Chuck Ebbert,
	Bartlomiej Zolnierkiewicz

On Thursday 28 October 2004 4:19 pm, Eric Mudama wrote:
> One of two things is happening:
>
> 1) Two drives are identically corrupted, producing the invalid serial
> numbers being reported in the ID block.  My belief is that this
> wasn't likely, given the low volume of reports.  The reported bad SN
> was "M0000000000000000000" which based on our firmware, I don't see
> how it could happen.  A corruption of the config sector (the most
> likely cause) *should* be catastrophic to the drive's functionality.
>
	Mine was the "D3000000" serial, not the "M0000000000000000000" serial. 
and the drives are not 100% identical, tho they are the same capacity, 
hooked to the same PDC20265 IDE bus, on a ASUS A7V266-E.

	I'd submit the /proc/ide/hd[gh]/identify but atm /proc seems to be 
blocking on that request. I'd submitted it before anyway.

> 2) There is a code or hardware bug somewhere outside of the drive
> itself that is causing this data to become corrupted.
>
> Either way, I believe the best course of action is to RMA the drives
> for new ones.  I don't think good stuff will come from having the
> linux kernel use drives that appear to be broken.
	The drives worked previously before the ide-probe patch, and have not 
been a problem before. and as I believe they only have a 1 year Maxtor 
warranty, i'm not sure i can RMA them, tho i'll keep it in mind.
>
> It'd be nice to test these drives on more systems, or with a bus
> analyzer, to identify the cause.
	Well... if i can't RMA them, and I do replace them, I offer to send 
them to you via UPS or FedEx.
>
> --eric
>
>
>
>
>
>
> On Wed, 27 Oct 2004 14:58:17 -0400, Gene Heskett
>
> <gene.heskett@verizon.net> wrote:
> > On Wednesday 27 October 2004 12:18, Alan Cox wrote:
> > >On Mer, 2004-10-27 at 17:10, Chuck Ebbert wrote:
> > >>         - accept bad Maxtor drive serial number
> > >
> > >This should not be applied. If your drive is no longer reporting
> > > its serial number then its faulty.
> >
> > ISTR he wrote that he had 2 (identical?) drives that were reporting
> > the same serial number.  Somewhat, but not exactly like I have two
> > different epson printers, both usb driven, and which except for the
> > reported serial number, return otherwise identical data when
> > queried by the usb drivers during dmesg.  Which I find odd because
> > one is a C82, 4 color model, and the other is a Photo 820, 6 color
> > model.
>
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Windows 95 is crash compatible with Windows 1.0, 2.x, and 3.x.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-10-29 18:00 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-29 18:00 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-ide, linux-kernel

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/pci/hpt34x.h   |   29 -----------------------
 Documentation/ide.txt      |    7 -----
 drivers/ide/Kconfig        |   13 ----------
 drivers/ide/ide-disk.c     |    3 --
 drivers/ide/ide-proc.c     |   25 ++++++++++----------
 drivers/ide/ide-taskfile.c |   10 ++++++--
 drivers/ide/ide.c          |    9 +------
 drivers/ide/pci/cs5520.c   |    2 -
 drivers/ide/pci/cs5530.c   |    1 
 drivers/ide/pci/hpt34x.c   |   17 +++++++++++--
 drivers/ide/ppc/pmac.c     |    7 -----
 drivers/ide/setup-pci.c    |   56 +++++++++------------------------------------
 include/linux/ide.h        |   10 +++-----
 13 files changed, 55 insertions(+), 134 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/10/29 1.2341)
   [ide] ide-disk: enable stroke by default
   
   From: Jens Axboe <axboe@suse.de>
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/29 1.2340)
   [ide] make destroy_proc_ide_interfaces static
   
   destroy_proc_ide_interfaces is only used inside ide-proc.c;
   so lets make it static.
   
   Signed-off-by: Arjan van de Ven <arjan@infradead.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/29 1.2339)
   [ide] kill IDEPCI_FLAG_FORCE_MASTER
   
   cs5530 overrides hwif->autodma anyway.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/29 1.2338)
   [ide] setup-pci: simplify autodma logic
   
   Do not set hwif->autodma in ide_pci_setup_ports().
   All DMA capable PCI host drivers override it.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/29 1.2337)
   [ide] setup-pci: small ide_get_or_set_dma_base() cleanup
   
   * hwif->dma_base is set in ->init_iops() for MMIO
   * if !dma_base then dma_base is really equal to zero
   * remove dead code from simplex check
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/29 1.2336)
   [ide] pmac: kill CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO
   
   DMA is always used by default (->autodma is never checked).
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/29 1.2335)
   [ide] hpt34x: kill hpt34x.h
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/29 1.2334)
   [ide] remove hwif from /proc/ide/ as part of ide_unregister_hwif()
   
   Original patch from Mark Lord <lkml@rtr.ca>.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/29 1.2333)
   [ide] PIO bugfix
   
   We need to k[un]map_atomic() the current page not the first page
   of the scatterlist segment.  Fixes OOPS when using HIGHMEM.
   
   Big thanks to Randy Dunlap for a lot of debugging/testing.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/Documentation/ide.txt b/Documentation/ide.txt
--- a/Documentation/ide.txt	2004-10-29 19:39:17 +02:00
+++ b/Documentation/ide.txt	2004-10-29 19:39:17 +02:00
@@ -248,13 +248,6 @@
  			  allowing ide-floppy, ide-tape, and ide-cdrom|writers
  			  to use ide-scsi emulation on a device specific option.
 
- "hdx=stroke"		: Should you have a system w/ an AWARD Bios and your
-			  drives are larger than 32GB and it will not boot,
-			  one is required to perform a few OEM operations first.
-			  The option is called "stroke" because it allows one
-			  to "soft clip" the drive to work around a barrier
-			  limit.
-
  "idebus=xx"		: inform IDE driver of VESA/PCI bus speed in MHz,
 			  where "xx" is between 20 and 66 inclusive,
 			  used when tuning chipset PIO modes.
diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig
--- a/drivers/ide/Kconfig	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/Kconfig	2004-10-29 19:39:17 +02:00
@@ -772,17 +772,6 @@
 	  This option enables the use of the sleep LED as a hard drive
 	  activity LED.
 
-config BLK_DEV_IDEDMA_PMAC_AUTO
-	bool "Use DMA by default"
-	depends on BLK_DEV_IDEDMA_PMAC
-	help
-	  This option allows the driver for the built-in IDE controller on
-	  Power Macintoshes and PowerBooks to use DMA automatically, without
-	  it having to be explicitly enabled.  This option is provided because
-	  of concerns about a couple of cases where using DMA on buggy PC
-	  hardware may have caused damage.  Saying Y should be safe on all
-	  Apple machines.
-
 config IDE_ARM
 	def_bool ARM && (ARCH_A5K || ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
 
@@ -1037,7 +1026,7 @@
 	  It is normally safe to answer Y; however, the default is N.
 
 config IDEDMA_AUTO
-	def_bool IDEDMA_PCI_AUTO || BLK_DEV_IDEDMA_PMAC_AUTO || IDEDMA_ICS_AUTO
+	def_bool IDEDMA_PCI_AUTO || IDEDMA_ICS_AUTO
 
 endif
 
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/ide-disk.c	2004-10-29 19:39:17 +02:00
@@ -643,9 +643,6 @@
 			 capacity, sectors_to_MB(capacity),
 			 set_max, sectors_to_MB(set_max));
 
-	if (!drive->stroke)
-		return;
-
 	if (lba48)
 		set_max = idedisk_set_max_address_ext(drive, set_max);
 	else
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/ide-proc.c	2004-10-29 19:39:17 +02:00
@@ -418,7 +418,7 @@
 	}
 }
 
-void destroy_proc_ide_drives(ide_hwif_t *hwif)
+static void destroy_proc_ide_drives(ide_hwif_t *hwif)
 {
 	int	d;
 
@@ -466,28 +466,29 @@
 EXPORT_SYMBOL_GPL(ide_pci_create_host_proc);
 #endif
 
-void destroy_proc_ide_interfaces(void)
+void destroy_proc_ide_interface(ide_hwif_t *hwif)
+{
+	if (hwif->proc) {
+		destroy_proc_ide_drives(hwif);
+		ide_remove_proc_entries(hwif->proc, hwif_entries);
+		remove_proc_entry(hwif->name, proc_ide_root);
+		hwif->proc = NULL;
+	}
+}
+
+static void destroy_proc_ide_interfaces(void)
 {
 	int	h;
 
 	for (h = 0; h < MAX_HWIFS; h++) {
 		ide_hwif_t *hwif = &ide_hwifs[h];
-		int exist = (hwif->proc != NULL);
 #if 0
 		if (!hwif->present)
 			continue;
 #endif
-		if (exist) {
-			destroy_proc_ide_drives(hwif);
-			ide_remove_proc_entries(hwif->proc, hwif_entries);
-			remove_proc_entry(hwif->name, proc_ide_root);
-			hwif->proc = NULL;
-		} else
-			continue;
+		destroy_proc_ide_interface(hwif);
 	}
 }
-
-EXPORT_SYMBOL(destroy_proc_ide_interfaces);
 
 extern struct seq_operations ide_drivers_op;
 static int ide_drivers_open(struct inode *inode, struct file *file)
diff -Nru a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
--- a/drivers/ide/ide-taskfile.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/ide-taskfile.c	2004-10-29 19:39:17 +02:00
@@ -274,14 +274,20 @@
 #ifdef CONFIG_HIGHMEM
 	unsigned long flags;
 #endif
+	unsigned int offset;
 	u8 *buf;
 
 	page = sg[hwif->cursg].page;
+	offset = sg[hwif->cursg].offset + hwif->cursg_ofs * SECTOR_SIZE;
+
+	/* get the current page and offset */
+	page = nth_page(page, (offset >> PAGE_SHIFT));
+	offset %= PAGE_SIZE;
+
 #ifdef CONFIG_HIGHMEM
 	local_irq_save(flags);
 #endif
-	buf = kmap_atomic(page, KM_BIO_SRC_IRQ) +
-	      sg[hwif->cursg].offset + (hwif->cursg_ofs * SECTOR_SIZE);
+	buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
 
 	hwif->nleft--;
 	hwif->cursg_ofs++;
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/ide.c	2004-10-29 19:39:17 +02:00
@@ -796,9 +796,7 @@
 		DRIVER(drive)->cleanup(drive);
 	}
 
-#ifdef CONFIG_PROC_FS
-	destroy_proc_ide_drives(hwif);
-#endif
+	destroy_proc_ide_interface(hwif);
 
 	hwgroup = hwif->hwgroup;
 	/*
@@ -1854,7 +1852,7 @@
 	if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) {
 		const char *hd_words[] = {
 			"none", "noprobe", "nowerr", "cdrom", "serialize",
-			"autotune", "noautotune", "stroke", "swapdata", "bswap",
+			"autotune", "noautotune", "minus8", "swapdata", "bswap",
 			"minus11", "remap", "remap63", "scsi", NULL };
 		unit = s[2] - 'a';
 		hw   = unit / MAX_DRIVES;
@@ -1887,9 +1885,6 @@
 				goto done;
 			case -7: /* "noautotune" */
 				drive->autotune = IDE_TUNE_NOAUTO;
-				goto done;
-			case -8: /* stroke */
-				drive->stroke = 1;
 				goto done;
 			case -9: /* "swapdata" */
 			case -10: /* "bswap" */
diff -Nru a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
--- a/drivers/ide/pci/cs5520.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/pci/cs5520.c	2004-10-29 19:39:17 +02:00
@@ -239,7 +239,7 @@
 	 *	do all the device setup for us
 	 */
 
-	ide_pci_setup_ports(dev, d, 1, 14, &index);
+	ide_pci_setup_ports(dev, d, 14, &index);
 
 	printk("Index.b %d %d\n", index.b.low, index.b.high);
 	mdelay(2000);
diff -Nru a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
--- a/drivers/ide/pci/cs5530.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/pci/cs5530.c	2004-10-29 19:39:17 +02:00
@@ -353,7 +353,6 @@
 	.channels	= 2,
 	.autodma	= AUTODMA,
 	.bootable	= ON_BOARD,
-	.flags		= IDEPCI_FLAG_FORCE_MASTER,
 };
 
 static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
--- a/drivers/ide/pci/hpt34x.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/pci/hpt34x.c	2004-10-29 19:39:17 +02:00
@@ -42,7 +42,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#include "hpt34x.h"
+#define HPT343_DEBUG_DRIVE_INFO		0
 
 static u8 hpt34x_ratemask (ide_drive_t *drive)
 {
@@ -69,7 +69,8 @@
 	u32 reg1= 0, tmp1 = 0, reg2 = 0, tmp2 = 0;
 	u8			hi_speed, lo_speed;
 
-	SPLIT_BYTE(speed, hi_speed, lo_speed);
+	hi_speed = speed >> 4;
+	lo_speed = speed & 0x0f;
 
 	if (hi_speed & 7) {
 		hi_speed = (hi_speed & 4) ? 0x01 : 0x10;
@@ -229,9 +230,19 @@
 	hwif->drives[1].autodma = hwif->autodma;
 }
 
+static ide_pci_device_t hpt34x_chipset __devinitdata = {
+	.name		= "HPT34X",
+	.init_chipset	= init_chipset_hpt34x,
+	.init_hwif	= init_hwif_hpt34x,
+	.channels	= 2,
+	.autodma	= NOAUTODMA,
+	.bootable	= NEVER_BOARD,
+	.extra		= 16
+};
+
 static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &hpt34x_chipsets[id->driver_data];
+	ide_pci_device_t *d = &hpt34x_chipset;
 	static char *chipset_names[] = {"HPT343", "HPT345"};
 	u16 pcicmd = 0;
 
diff -Nru a/drivers/ide/pci/hpt34x.h b/drivers/ide/pci/hpt34x.h
--- a/drivers/ide/pci/hpt34x.h	2004-10-29 19:39:17 +02:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,29 +0,0 @@
-#ifndef HPT34X_H
-#define HPT34X_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define HPT343_DEBUG_DRIVE_INFO		0
-
-#ifndef SPLIT_BYTE
-#define SPLIT_BYTE(B,H,L)	((H)=(B>>4), (L)=(B-((B>>4)<<4)))
-#endif
-
-static unsigned int init_chipset_hpt34x(struct pci_dev *, const char *);
-static void init_hwif_hpt34x(ide_hwif_t *);
-
-static ide_pci_device_t hpt34x_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.name		= "HPT34X",
-		.init_chipset	= init_chipset_hpt34x,
-		.init_hwif	= init_hwif_hpt34x,
-		.channels	= 2,
-		.autodma	= NOAUTODMA,
-		.bootable	= NEVER_BOARD,
-		.extra		= 16
-	}
-};
-
-#endif /* HPT34X_H */
diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
--- a/drivers/ide/ppc/pmac.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/ppc/pmac.c	2004-10-29 19:39:17 +02:00
@@ -2028,13 +2028,6 @@
 	hwif->ide_dma_timeout = &__ide_dma_timeout;
 	hwif->ide_dma_lostirq = &pmac_ide_dma_lostirq;
 
-#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO
-	if (!noautodma)
-		hwif->autodma = 1;
-#endif
-	hwif->drives[0].autodma = hwif->autodma;
-	hwif->drives[1].autodma = hwif->autodma;
-
 	hwif->atapi_dma = 1;
 	switch(pmif->kind) {
 		case controller_un_ata6:
diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
--- a/drivers/ide/setup-pci.c	2004-10-29 19:39:17 +02:00
+++ b/drivers/ide/setup-pci.c	2004-10-29 19:39:17 +02:00
@@ -185,19 +185,16 @@
 second_chance_to_dma:
 #endif /* CONFIG_BLK_DEV_IDEDMA_FORCED */
 
-	if ((hwif->mmio) && (hwif->dma_base))
+	if (hwif->mmio)
 		return hwif->dma_base;
 
 	if (hwif->mate && hwif->mate->dma_base) {
 		dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8);
 	} else {
-		dma_base = (hwif->mmio) ?
-			((unsigned long) hwif->hwif_data) :
-			(pci_resource_start(dev, 4));
+		dma_base = pci_resource_start(dev, 4);
 		if (!dma_base) {
-			printk(KERN_ERR "%s: dma_base is invalid (0x%04lx)\n",
-				hwif->cds->name, dma_base);
-			dma_base = 0;
+			printk(KERN_ERR "%s: dma_base is invalid\n",
+					hwif->cds->name);
 		}
 	}
 
@@ -251,7 +248,6 @@
 				simplex_stat = hwif->INB(dma_base + 2);
 				if (simplex_stat & 0x80) {
 					/* simplex device? */
-#if 0					
 /*
  *	At this point we haven't probed the drives so we can't make the
  *	appropriate decision. Really we should defer this problem
@@ -259,18 +255,7 @@
  *	to be the DMA end. This has to be become dynamic to handle hot
  *	plug.
  */
-					/* Don't enable DMA on a simplex channel with no drives */
-					if (!hwif->drives[0].present && !hwif->drives[1].present)
-					{
-						printk(KERN_INFO "%s: simplex device with no drives: DMA disabled\n",
-								hwif->cds->name);
-						dma_base = 0;
-					}
-					/* If our other channel has DMA then we cannot */
-					else 
-#endif					
-					if(hwif->mate && hwif->mate->dma_base) 
-					{
+					if (hwif->mate && hwif->mate->dma_base) {
 						printk(KERN_INFO "%s: simplex device: "
 							"DMA disabled\n",
 							hwif->cds->name);
@@ -488,13 +473,8 @@
  			 * Set up BM-DMA capability
 			 * (PnP BIOS should have done this)
  			 */
-			if ((d->flags & IDEPCI_FLAG_FORCE_MASTER) == 0) {
-				/*
-				 * default DMA off if we had to
-				 * configure it here
-				 */
-				hwif->autodma = 0;
-			}
+			/* default DMA off if we had to configure it here */
+			hwif->autodma = 0;
 			pci_set_master(dev);
 			if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || !(pcicmd & PCI_COMMAND_MASTER)) {
 				printk(KERN_ERR "%s: %s error updating PCICMD\n",
@@ -530,13 +510,9 @@
  
 static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config)
 {
-	int ret = 0;
 	u32 class_rev;
 	u16 pcicmd;
 
-	if (!noautodma)
-		ret = 1;
-
 	if (noisy)
 		ide_setup_pci_noise(dev, d);
 
@@ -550,8 +526,6 @@
 	if (!(pcicmd & PCI_COMMAND_IO)) {	/* is device disabled? */
 		if (ide_pci_configure(dev, d))
 			return -ENODEV;
-		/* default DMA off if we had to configure it here */
-		ret = 0;
 		*config = 1;
 		printk(KERN_INFO "%s: device enabled (Linux)\n", d->name);
 	}
@@ -560,14 +534,13 @@
 	class_rev &= 0xff;
 	if (noisy)
 		printk(KERN_INFO "%s: chipset revision %d\n", d->name, class_rev);
-	return ret;
+	return 0;
 }
 
 /**
  *	ide_pci_setup_ports	-	configure ports/devices on PCI IDE
  *	@dev: PCI device
  *	@d: IDE pci device info
- *	@autodma: Should we enable DMA
  *	@pciirq: IRQ line
  *	@index: ata index to update
  *
@@ -580,7 +553,7 @@
  *	where the chipset setup is not the default PCI IDE one.
  */
  
-void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int autodma, int pciirq, ata_index_t *index)
+void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index)
 {
 	int port;
 	int at_least_one_hwif_enabled = 0;
@@ -634,11 +607,7 @@
 
 		if (d->autodma == NODMA)
 			goto bypass_legacy_dma;
-		if (d->autodma == NOAUTODMA)
-			autodma = 0;
-		if (autodma)
-			hwif->autodma = 1;
-			
+
 		if(d->init_setup_dma)
 			d->init_setup_dma(dev, d, hwif);
 		else
@@ -671,12 +640,11 @@
  */
 static ata_index_t do_ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_t *d, u8 noisy)
 {
-	int autodma = 0;
 	int pciirq = 0;
 	int tried_config = 0;
 	ata_index_t index = { .b = { .low = 0xff, .high = 0xff } };
 
-	if((autodma = ide_setup_pci_controller(dev, d, noisy, &tried_config)) < 0)
+	if (ide_setup_pci_controller(dev, d, noisy, &tried_config) < 0)
 		return index;
 
 	/*
@@ -724,7 +692,7 @@
 	if(pciirq < 0)		/* Error not an IRQ */
 		return index;
 
-	ide_pci_setup_ports(dev, d, autodma, pciirq, &index);
+	ide_pci_setup_ports(dev, d, pciirq, &index);
 
 	return index;
 }
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2004-10-29 19:39:17 +02:00
+++ b/include/linux/ide.h	2004-10-29 19:39:17 +02:00
@@ -739,7 +739,6 @@
 	unsigned remap_0_to_1	: 1;	/* 0=noremap, 1=remap 0->1 (for EZDrive) */
 	unsigned blocked        : 1;	/* 1=powermanagment told us not to do anything, so sleep nicely */
 	unsigned vdma		: 1;	/* 1=doing PIO over DMA 0=doing normal DMA */
-	unsigned stroke		: 1;	/* from:  hdx=stroke */
 	unsigned addressing;		/*      : 3;
 					 *  0=28-bit
 					 *  1=48-bit
@@ -1045,8 +1044,8 @@
 
 extern void proc_ide_create(void);
 extern void proc_ide_destroy(void);
-extern void destroy_proc_ide_drives(ide_hwif_t *);
 extern void create_proc_ide_interfaces(void);
+void destroy_proc_ide_interface(ide_hwif_t *);
 extern void ide_add_proc_entries(struct proc_dir_entry *, ide_proc_entry_t *, void *);
 extern void ide_remove_proc_entries(struct proc_dir_entry *, ide_proc_entry_t *);
 read_proc_t proc_ide_read_capacity;
@@ -1073,6 +1072,7 @@
 }
 #else
 static inline void create_proc_ide_interfaces(void) { ; }
+static inline void destroy_proc_ide_interface(ide_hwif_t *hwif) { ; }
 #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
 #endif
 
@@ -1417,7 +1417,7 @@
 extern void ide_scan_pcibus(int scan_direction) __init;
 extern int ide_pci_register_driver(struct pci_driver *driver);
 extern void ide_pci_unregister_driver(struct pci_driver *driver);
-extern void ide_pci_setup_ports(struct pci_dev *dev, struct ide_pci_device_s *d, int autodma, int pciirq, ata_index_t *index);
+void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
 extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d);
 
 extern void default_hwif_iops(ide_hwif_t *);
@@ -1452,9 +1452,7 @@
 enum {
 	/* Uses ISA control ports not PCI ones. */
 	IDEPCI_FLAG_ISA_PORTS		= (1 << 0),
-
-	IDEPCI_FLAG_FORCE_MASTER	= (1 << 1),
-	IDEPCI_FLAG_FORCE_PDC		= (1 << 2),
+	IDEPCI_FLAG_FORCE_PDC		= (1 << 1),
 };
 
 typedef struct ide_pci_device_s {

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 18:58   ` Gene Heskett
@ 2004-10-28 20:19     ` Eric Mudama
  2004-10-30 15:48       ` tabris
  0 siblings, 1 reply; 53+ messages in thread
From: Eric Mudama @ 2004-10-28 20:19 UTC (permalink / raw)
  To: gene.heskett
  Cc: linux-kernel, Alan Cox, Chuck Ebbert, Bartlomiej Zolnierkiewicz

One of two things is happening:

1) Two drives are identically corrupted, producing the invalid serial
numbers being reported in the ID block.  My belief is that this wasn't
likely, given the low volume of reports.  The reported bad SN was
"M0000000000000000000" which based on our firmware, I don't see how it
could happen.  A corruption of the config sector (the most likely
cause) *should* be catastrophic to the drive's functionality.

2) There is a code or hardware bug somewhere outside of the drive
itself that is causing this data to become corrupted.

Either way, I believe the best course of action is to RMA the drives
for new ones.  I don't think good stuff will come from having the
linux kernel use drives that appear to be broken.

It'd be nice to test these drives on more systems, or with a bus
analyzer, to identify the cause.

--eric






On Wed, 27 Oct 2004 14:58:17 -0400, Gene Heskett
<gene.heskett@verizon.net> wrote:
> On Wednesday 27 October 2004 12:18, Alan Cox wrote:
> >On Mer, 2004-10-27 at 17:10, Chuck Ebbert wrote:
> >>         - accept bad Maxtor drive serial number
> >
> >This should not be applied. If your drive is no longer reporting its
> >serial number then its faulty.
> 
> ISTR he wrote that he had 2 (identical?) drives that were reporting
> the same serial number.  Somewhat, but not exactly like I have two
> different epson printers, both usb driven, and which except for the
> reported serial number, return otherwise identical data when queried
> by the usb drivers during dmesg.  Which I find odd because one is a
> C82, 4 color model, and the other is a Photo 820, 6 color model.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 17:20       ` Linus Torvalds
  2004-10-27 18:26         ` Gene Heskett
@ 2004-10-28  6:45         ` Gene Heskett
  1 sibling, 0 replies; 53+ messages in thread
From: Gene Heskett @ 2004-10-28  6:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, Bartlomiej Zolnierkiewicz, linux-ide

On Wednesday 27 October 2004 13:20, Linus Torvalds wrote:
>On Wed, 27 Oct 2004, Gene Heskett wrote:
>> >current linus' -bk tree, latest -bk snapshot should also be OK
>>
>> Drat.  I can't afford bitkeeper, either the time or the resources.
>> So I assume this will be in 2.6.10-rc2 or 3?
>
>You can also just do the the daily snapshots - in
>/pub/linux/kernel/v2.6/snapshots.
>
>But yes, I'm also pulling Bartlomiej's tree into the next release,
> so if you can wait..
>
>  Linus

I went after 2.6.10-rc1, and the bk6 patch for it, and its been 
running here for about 2 hours, no hits, no runs, no errors so far.
I watched a little tvtime, browsed with FF for an hour or so, and of 
course kmail runs full time here.  And amanda just finished up.  It 
feels good, and Just Works(tm).

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.28% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 18:41           ` Linus Torvalds
@ 2004-10-27 19:03             ` Gene Heskett
  0 siblings, 0 replies; 53+ messages in thread
From: Gene Heskett @ 2004-10-27 19:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, Bartlomiej Zolnierkiewicz, linux-ide

On Wednesday 27 October 2004 14:41, Linus Torvalds wrote:
>On Wed, 27 Oct 2004, Gene Heskett wrote:
>> I don't know for sure if I'm having a problem or not Linus, but I
>> had to dl fc3rc1's iso's several times to get all good md5sums.
>
>I don't think it was your side, I saw it too.
>
>They seem to have replaced the test-rc ISO images in the middle or
> had some server trouble, so the md5sums simply didn't match
> originally.
>
>  Linus

Good, so I'm not crazy after all, as someone on the fedora list 
accused me of yesterday when I went off topic, at length, responding 
to a political rant about the shrub and about freedoms in general.  
Thanks, I needed that. :)

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.28% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 16:18 ` Alan Cox
@ 2004-10-27 18:58   ` Gene Heskett
  2004-10-28 20:19     ` Eric Mudama
  0 siblings, 1 reply; 53+ messages in thread
From: Gene Heskett @ 2004-10-27 18:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan Cox, Chuck Ebbert, Bartlomiej Zolnierkiewicz

On Wednesday 27 October 2004 12:18, Alan Cox wrote:
>On Mer, 2004-10-27 at 17:10, Chuck Ebbert wrote:
>>         - accept bad Maxtor drive serial number
>
>This should not be applied. If your drive is no longer reporting its
>serial number then its faulty.

ISTR he wrote that he had 2 (identical?) drives that were reporting 
the same serial number.  Somewhat, but not exactly like I have two 
different epson printers, both usb driven, and which except for the 
reported serial number, return otherwise identical data when queried 
by the usb drivers during dmesg.  Which I find odd because one is a 
C82, 4 color model, and the other is a Photo 820, 6 color model.

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.28% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 18:26         ` Gene Heskett
@ 2004-10-27 18:41           ` Linus Torvalds
  2004-10-27 19:03             ` Gene Heskett
  0 siblings, 1 reply; 53+ messages in thread
From: Linus Torvalds @ 2004-10-27 18:41 UTC (permalink / raw)
  To: Gene Heskett; +Cc: linux-kernel, Bartlomiej Zolnierkiewicz, linux-ide



On Wed, 27 Oct 2004, Gene Heskett wrote:
> 
> I don't know for sure if I'm having a problem or not Linus, but I had 
> to dl fc3rc1's iso's several times to get all good md5sums.  

I don't think it was your side, I saw it too.

They seem to have replaced the test-rc ISO images in the middle or had
some server trouble, so the md5sums simply didn't match originally.

		Linus

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 17:20       ` Linus Torvalds
@ 2004-10-27 18:26         ` Gene Heskett
  2004-10-27 18:41           ` Linus Torvalds
  2004-10-28  6:45         ` Gene Heskett
  1 sibling, 1 reply; 53+ messages in thread
From: Gene Heskett @ 2004-10-27 18:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, Bartlomiej Zolnierkiewicz, linux-ide

On Wednesday 27 October 2004 13:20, Linus Torvalds wrote:
>On Wed, 27 Oct 2004, Gene Heskett wrote:
>> >current linus' -bk tree, latest -bk snapshot should also be OK
>>
>> Drat.  I can't afford bitkeeper, either the time or the resources.
>> So I assume this will be in 2.6.10-rc2 or 3?
>
>You can also just do the the daily snapshots - in
>/pub/linux/kernel/v2.6/snapshots.
>
>But yes, I'm also pulling Bartlomiej's tree into the next release,
> so if you can wait..
>
>  Linus

I don't know for sure if I'm having a problem or not Linus, but I had 
to dl fc3rc1's iso's several times to get all good md5sums.  
Something was fscking things using mozilla-1.7.3...  So I wrote a 
script to use wget for FC3rc2 & we'll see if that works in a few 
hours when its all here.  On a slow (768/128) DSL, and trying to 
squeeze an extra character for email in from time to time.
 
-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.28% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 17:15       ` Bartlomiej Zolnierkiewicz
@ 2004-10-27 18:19         ` Gene Heskett
  0 siblings, 0 replies; 53+ messages in thread
From: Gene Heskett @ 2004-10-27 18:19 UTC (permalink / raw)
  To: linux-kernel, Bartlomiej Zolnierkiewicz; +Cc: torvalds, linux-ide

On Wednesday 27 October 2004 13:15, Bartlomiej Zolnierkiewicz wrote:
>>On Wed, 27 Oct 2004 13:05:06 -0400, Gene Heskett

>> Drat.  I can't afford bitkeeper, either the time or the resources.
>> So I assume this will be in 2.6.10-rc2 or 3?
>
>I hope it will be in the next -bk snapshot...

I just grabbed 2.6.10-rc1-bk6.  Dated about 3 hours ago if the time 
zones are the same.

Thanks

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.28% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 17:02       ` Randy.Dunlap
@ 2004-10-27 18:17         ` Gene Heskett
  0 siblings, 0 replies; 53+ messages in thread
From: Gene Heskett @ 2004-10-27 18:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Randy.Dunlap, Bartlomiej Zolnierkiewicz, torvalds, linux-ide

On Wednesday 27 October 2004 13:02, Randy.Dunlap wrote:

>Gene,
>
>BK isn't required.  Just get the daily snapshot from
>http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/
>and apply it to 2.6.10-rc1 (or whatever is latest).

Ahh, thanks, done.

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.28% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 17:05     ` Gene Heskett
  2004-10-27 17:02       ` Randy.Dunlap
  2004-10-27 17:15       ` Bartlomiej Zolnierkiewicz
@ 2004-10-27 17:20       ` Linus Torvalds
  2004-10-27 18:26         ` Gene Heskett
  2004-10-28  6:45         ` Gene Heskett
  2 siblings, 2 replies; 53+ messages in thread
From: Linus Torvalds @ 2004-10-27 17:20 UTC (permalink / raw)
  To: Gene Heskett; +Cc: linux-kernel, Bartlomiej Zolnierkiewicz, linux-ide



On Wed, 27 Oct 2004, Gene Heskett wrote:
> >
> >current linus' -bk tree, latest -bk snapshot should also be OK
> 
> Drat.  I can't afford bitkeeper, either the time or the resources.
> So I assume this will be in 2.6.10-rc2 or 3?

You can also just do the the daily snapshots - in
/pub/linux/kernel/v2.6/snapshots.

But yes, I'm also pulling Bartlomiej's tree into the next release, so if 
you can wait..

		Linus

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 17:05     ` Gene Heskett
  2004-10-27 17:02       ` Randy.Dunlap
@ 2004-10-27 17:15       ` Bartlomiej Zolnierkiewicz
  2004-10-27 18:19         ` Gene Heskett
  2004-10-27 17:20       ` Linus Torvalds
  2 siblings, 1 reply; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-27 17:15 UTC (permalink / raw)
  To: gene.heskett; +Cc: linux-kernel, torvalds, linux-ide

On Wed, 27 Oct 2004 13:05:06 -0400, Gene Heskett
<gene.heskett@verizon.net> wrote:
> On Wednesday 27 October 2004 12:22, Bartlomiej Zolnierkiewicz wrote:
> 
> 
> >On Wed, 27 Oct 2004 12:15:55 -0400, Gene Heskett
> >
> ><gene.heskett@verizon.net> wrote:
> >> On Wednesday 27 October 2004 09:07, Bartlomiej Zolnierkiewicz
> wrote:
> >> >Please do a
> >> >
> >> > bk pull bk://bart.bkbits.net/ide-2.6
> >> >
> >> >This will update the following files:
> >> >
> >> > drivers/ide/ide-disk.c         |    1 +
> >> > drivers/ide/ide-dma.c          |   32
> >>
> >> Even after fixing the 4 wrapped lines in the patch, I'm not going
> >> in cleanly here:
> >>
> >> patching file drivers/ide/ide-dma.c
> >> Hunk #1 FAILED at 681.
> >> 1 out of 1 hunk FAILED -- saving rejects to file
> >> drivers/ide/ide-dma.c.rej
> >>
> >> The first 'grep' line of the patch is found at an offset of about
> >> +180 lines in the original file.
> >>
> >> The rest of it seems to have found a home, but at offsets in
> >> excess of 159 lines for a few of them.
> >>
> >> This was against a 2.6.9 tree, and 2.6.9-mm1 failed in similar
> >> fashion.  What src tree is this to be applied to?
> >
> >current linus' -bk tree, latest -bk snapshot should also be OK
> 
> Drat.  I can't afford bitkeeper, either the time or the resources.
> So I assume this will be in 2.6.10-rc2 or 3?

I hope it will be in the next -bk snapshot...

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 16:22   ` Bartlomiej Zolnierkiewicz
@ 2004-10-27 17:05     ` Gene Heskett
  2004-10-27 17:02       ` Randy.Dunlap
                         ` (2 more replies)
  0 siblings, 3 replies; 53+ messages in thread
From: Gene Heskett @ 2004-10-27 17:05 UTC (permalink / raw)
  To: linux-kernel, Bartlomiej Zolnierkiewicz; +Cc: torvalds, linux-ide

On Wednesday 27 October 2004 12:22, Bartlomiej Zolnierkiewicz wrote:
>On Wed, 27 Oct 2004 12:15:55 -0400, Gene Heskett
>
><gene.heskett@verizon.net> wrote:
>> On Wednesday 27 October 2004 09:07, Bartlomiej Zolnierkiewicz 
wrote:
>> >Please do a
>> >
>> > bk pull bk://bart.bkbits.net/ide-2.6
>> >
>> >This will update the following files:
>> >
>> > drivers/ide/ide-disk.c         |    1 +
>> > drivers/ide/ide-dma.c          |   32
>>
>> Even after fixing the 4 wrapped lines in the patch, I'm not going
>> in cleanly here:
>>
>> patching file drivers/ide/ide-dma.c
>> Hunk #1 FAILED at 681.
>> 1 out of 1 hunk FAILED -- saving rejects to file
>> drivers/ide/ide-dma.c.rej
>>
>> The first 'grep' line of the patch is found at an offset of about
>> +180 lines in the original file.
>>
>> The rest of it seems to have found a home, but at offsets in
>> excess of 159 lines for a few of them.
>>
>> This was against a 2.6.9 tree, and 2.6.9-mm1 failed in similar
>> fashion.  What src tree is this to be applied to?
>
>current linus' -bk tree, latest -bk snapshot should also be OK

Drat.  I can't afford bitkeeper, either the time or the resources.
So I assume this will be in 2.6.10-rc2 or 3?

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.28% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 17:05     ` Gene Heskett
@ 2004-10-27 17:02       ` Randy.Dunlap
  2004-10-27 18:17         ` Gene Heskett
  2004-10-27 17:15       ` Bartlomiej Zolnierkiewicz
  2004-10-27 17:20       ` Linus Torvalds
  2 siblings, 1 reply; 53+ messages in thread
From: Randy.Dunlap @ 2004-10-27 17:02 UTC (permalink / raw)
  To: gene.heskett; +Cc: linux-kernel, Bartlomiej Zolnierkiewicz, torvalds, linux-ide

Gene Heskett wrote:
> On Wednesday 27 October 2004 12:22, Bartlomiej Zolnierkiewicz wrote:
> 
>>On Wed, 27 Oct 2004 12:15:55 -0400, Gene Heskett
>>
>><gene.heskett@verizon.net> wrote:
>>
>>>On Wednesday 27 October 2004 09:07, Bartlomiej Zolnierkiewicz 
> 
> wrote:
> 
>>>>Please do a
>>>>
>>>>bk pull bk://bart.bkbits.net/ide-2.6
>>>>
>>>>This will update the following files:
>>>>
>>>>drivers/ide/ide-disk.c         |    1 +
>>>>drivers/ide/ide-dma.c          |   32
>>>
>>>Even after fixing the 4 wrapped lines in the patch, I'm not going
>>>in cleanly here:
>>>
>>>patching file drivers/ide/ide-dma.c
>>>Hunk #1 FAILED at 681.
>>>1 out of 1 hunk FAILED -- saving rejects to file
>>>drivers/ide/ide-dma.c.rej
>>>
>>>The first 'grep' line of the patch is found at an offset of about
>>>+180 lines in the original file.
>>>
>>>The rest of it seems to have found a home, but at offsets in
>>>excess of 159 lines for a few of them.
>>>
>>>This was against a 2.6.9 tree, and 2.6.9-mm1 failed in similar
>>>fashion.  What src tree is this to be applied to?
>>
>>current linus' -bk tree, latest -bk snapshot should also be OK
> 
> 
> Drat.  I can't afford bitkeeper, either the time or the resources.
> So I assume this will be in 2.6.10-rc2 or 3?

Gene,

BK isn't required.  Just get the daily snapshot from
http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/
and apply it to 2.6.10-rc1 (or whatever is latest).

-- 
~Randy
MOTD:  Always include version info.
(Again.  Sometimes I think ln -s /usr/src/linux/.config .signature)

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 16:10 Chuck Ebbert
  2004-10-27 16:18 ` Alan Cox
@ 2004-10-27 16:29 ` Bartlomiej Zolnierkiewicz
  1 sibling, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-27 16:29 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: linux-kernel, linux-ide

On Wed, 27 Oct 2004 12:10:50 -0400, Chuck Ebbert
<76306.1226@compuserve.com> wrote:
> On Wed, 27 Oct 2004 at 15:07:14 +0200 Bartlomiej Zolnierkiewicz wrote:
> 
> >@@ -585,7 +564,8 @@
> >       struct pci_dev *dev = hwif->pci_dev;
> >
> >       /* PDC20265 has problems with large LBA48 requests */
> >-      if (dev->device == PCI_DEVICE_ID_PROMISE_20265)
> >+      if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) ||
> >+          (dev->device == PCI_DEVICE_ID_PROMISE_20265))
> >               hwif->rqsize = 256;
> >
> >       hwif->autodma = 0;
> 
> 
>    You forgot to update the comment...

ah, care to send a patch?

>    I added this and the smart_thresholds() fix to my 2.6.9-base patches.
> 
>    Now I have these ide fixes:
> 
>         - smart_thresholds() fix
>         - pdc202xx_old LBA48 fix
>         - accept bad Maxtor drive serial number
>         - allow drive that reports no geometry
> 
>    Should anything more really be in there?

Nope, looks like you've all critical stuff.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 16:15 ` Gene Heskett
@ 2004-10-27 16:22   ` Bartlomiej Zolnierkiewicz
  2004-10-27 17:05     ` Gene Heskett
  0 siblings, 1 reply; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-27 16:22 UTC (permalink / raw)
  To: gene.heskett; +Cc: linux-kernel, torvalds, linux-ide

On Wed, 27 Oct 2004 12:15:55 -0400, Gene Heskett
<gene.heskett@verizon.net> wrote:
> On Wednesday 27 October 2004 09:07, Bartlomiej Zolnierkiewicz wrote:
> >Please do a
> >
> > bk pull bk://bart.bkbits.net/ide-2.6
> >
> >This will update the following files:
> >
> > drivers/ide/ide-disk.c         |    1 +
> > drivers/ide/ide-dma.c          |   32
> 
> Even after fixing the 4 wrapped lines in the patch, I'm not going in
> cleanly here:
> 
> patching file drivers/ide/ide-dma.c
> Hunk #1 FAILED at 681.
> 1 out of 1 hunk FAILED -- saving rejects to file
> drivers/ide/ide-dma.c.rej
> 
> The first 'grep' line of the patch is found at an offset of about +180
> lines in the original file.
> 
> The rest of it seems to have found a home, but at offsets in excess of
> 159 lines for a few of them.
> 
> This was against a 2.6.9 tree, and 2.6.9-mm1 failed in similar
> fashion.  What src tree is this to be applied to?

current linus' -bk tree, latest -bk snapshot should also be OK

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 16:10 Chuck Ebbert
@ 2004-10-27 16:18 ` Alan Cox
  2004-10-27 18:58   ` Gene Heskett
  2004-10-27 16:29 ` Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 53+ messages in thread
From: Alan Cox @ 2004-10-27 16:18 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: Bartlomiej Zolnierkiewicz, Linux Kernel Mailing List

On Mer, 2004-10-27 at 17:10, Chuck Ebbert wrote:
>         - accept bad Maxtor drive serial number

This should not be applied. If your drive is no longer reporting its
serial number then its faulty.


^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 13:07 Bartlomiej Zolnierkiewicz
  2004-10-27 13:34 ` CaT
  2004-10-27 14:29 ` J.A. Magallon
@ 2004-10-27 16:15 ` Gene Heskett
  2004-10-27 16:22   ` Bartlomiej Zolnierkiewicz
  2 siblings, 1 reply; 53+ messages in thread
From: Gene Heskett @ 2004-10-27 16:15 UTC (permalink / raw)
  To: linux-kernel, Bartlomiej Zolnierkiewicz; +Cc: torvalds, linux-ide

On Wednesday 27 October 2004 09:07, Bartlomiej Zolnierkiewicz wrote:
>Please do a
>
> bk pull bk://bart.bkbits.net/ide-2.6
>
>This will update the following files:
>
> drivers/ide/ide-disk.c         |    1 +
> drivers/ide/ide-dma.c          |   32

Even after fixing the 4 wrapped lines in the patch, I'm not going in 
cleanly here:

patching file drivers/ide/ide-dma.c
Hunk #1 FAILED at 681.
1 out of 1 hunk FAILED -- saving rejects to file 
drivers/ide/ide-dma.c.rej

The first 'grep' line of the patch is found at an offset of about +180 
lines in the original file.

The rest of it seems to have found a home, but at offsets in excess of 
159 lines for a few of them.

This was against a 2.6.9 tree, and 2.6.9-mm1 failed in similar 
fashion.  What src tree is this to be applied to?

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.28% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
@ 2004-10-27 16:10 Chuck Ebbert
  2004-10-27 16:18 ` Alan Cox
  2004-10-27 16:29 ` Bartlomiej Zolnierkiewicz
  0 siblings, 2 replies; 53+ messages in thread
From: Chuck Ebbert @ 2004-10-27 16:10 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-kernel

On Wed, 27 Oct 2004 at 15:07:14 +0200 Bartlomiej Zolnierkiewicz wrote:

>@@ -585,7 +564,8 @@
>       struct pci_dev *dev = hwif->pci_dev;
> 
>       /* PDC20265 has problems with large LBA48 requests */
>-      if (dev->device == PCI_DEVICE_ID_PROMISE_20265)
>+      if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) ||
>+          (dev->device == PCI_DEVICE_ID_PROMISE_20265))
>               hwif->rqsize = 256;
> 
>       hwif->autodma = 0;


   You forgot to update the comment...


   I added this and the smart_thresholds() fix to my 2.6.9-base patches.

   Now I have these ide fixes:

        - smart_thresholds() fix
        - pdc202xx_old LBA48 fix
        - accept bad Maxtor drive serial number
        - allow drive that reports no geometry

   Should anything more really be in there?


--Chuck Ebbert  27-Oct-04  12:04:38

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 14:29 ` J.A. Magallon
@ 2004-10-27 15:07   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-27 15:07 UTC (permalink / raw)
  To: J.A. Magallon; +Cc: linux-ide, linux-kernel

On Wed, 27 Oct 2004 14:29:23 +0000, J.A. Magallon <jamagallon@able.es> wrote:
> 
> On 2004.10.27, Bartlomiej Zolnierkiewicz wrote:
> > Please do a
> >
> >       bk pull bk://bart.bkbits.net/ide-2.6
> >
> > This will update the following files:
> 
> Watch your mailer, it is wrapping lines...
> See:
> 
> http://marc.theaimsgroup.com/?l=linux-ide&m=109888304706759&q=raw
> 
> and search for 'long data_size'.

thanks

bye, bye gmail

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 14:33     ` Mikael Pettersson
@ 2004-10-27 14:49       ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-27 14:49 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: CaT, torvalds, linux-ide, linux-kernel

On Wed, 27 Oct 2004 16:33:26 +0200, Mikael Pettersson <mikpe@csd.uu.se> wrote:
> Bartlomiej Zolnierkiewicz writes:
> 
> 
>  > http://bugme.osdl.org/show_bug.cgi?id=2494
>  >
>  > On Wed, 27 Oct 2004 23:34:31 +1000, CaT <cat@zip.com.au> wrote:
>  > > On Wed, Oct 27, 2004 at 03:07:14PM +0200, Bartlomiej Zolnierkiewicz wrote:
>  > > > <bzolnier@trik.(none)> (04/10/26 1.2192)
>  > > >    [ide] pdc202xx_old: PDC20267 needs the same LBA48 fixup as PDC20265
>  > >
>  > > What would the symptoms of this bug be? I've got a PDC20267 and I'm
>  > > having a few issues transferring from hde to hdh (ie across two ports)
>  > > it seems. My work at duplicating things seems to work best when I do a
>  > > transfer like that rather then going from say, a totall different
>  > > controller to the pdc (hdh) or even from generated input to the pdc (hdh).
> 
> I see only one note where someone claims the '67 is affected.
> What would trigger it? A large disk or just heavy I/O?
> FWIW, my news server has received, stored, manipulated, and sent >500
> gigabytes of data using a lowly 20267 add-on card in a 440BX mobo,
> and has _never_ had any problems, and I/O is sometimes very heavy.

request with number of sectors > 256 on LBA48 capable disk
(!= large disk)

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 13:51   ` Bartlomiej Zolnierkiewicz
@ 2004-10-27 14:33     ` Mikael Pettersson
  2004-10-27 14:49       ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 53+ messages in thread
From: Mikael Pettersson @ 2004-10-27 14:33 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: CaT, torvalds, linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz writes:
 > http://bugme.osdl.org/show_bug.cgi?id=2494
 > 
 > On Wed, 27 Oct 2004 23:34:31 +1000, CaT <cat@zip.com.au> wrote:
 > > On Wed, Oct 27, 2004 at 03:07:14PM +0200, Bartlomiej Zolnierkiewicz wrote:
 > > > <bzolnier@trik.(none)> (04/10/26 1.2192)
 > > >    [ide] pdc202xx_old: PDC20267 needs the same LBA48 fixup as PDC20265
 > > 
 > > What would the symptoms of this bug be? I've got a PDC20267 and I'm
 > > having a few issues transferring from hde to hdh (ie across two ports)
 > > it seems. My work at duplicating things seems to work best when I do a
 > > transfer like that rather then going from say, a totall different
 > > controller to the pdc (hdh) or even from generated input to the pdc (hdh).

I see only one note where someone claims the '67 is affected.
What would trigger it? A large disk or just heavy I/O?
FWIW, my news server has received, stored, manipulated, and sent >500
gigabytes of data using a lowly 20267 add-on card in a 440BX mobo,
and has _never_ had any problems, and I/O is sometimes very heavy.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 13:07 Bartlomiej Zolnierkiewicz
  2004-10-27 13:34 ` CaT
@ 2004-10-27 14:29 ` J.A. Magallon
  2004-10-27 15:07   ` Bartlomiej Zolnierkiewicz
  2004-10-27 16:15 ` Gene Heskett
  2 siblings, 1 reply; 53+ messages in thread
From: J.A. Magallon @ 2004-10-27 14:29 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel


On 2004.10.27, Bartlomiej Zolnierkiewicz wrote:
> Please do a
> 
> 	bk pull bk://bart.bkbits.net/ide-2.6
> 
> This will update the following files:

Watch your mailer, it is wrapping lines...
See:

http://marc.theaimsgroup.com/?l=linux-ide&m=109888304706759&q=raw

and search for 'long data_size'.

--
J.A. Magallon <jamagallon()able!es>     \               Software is like sex:
werewolf!able!es                         \         It's better when it's free
Mandrakelinux release 10.1 (Community) for i586
Linux 2.6.9-jam1 (gcc 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)) #4



^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 13:34 ` CaT
@ 2004-10-27 13:51   ` Bartlomiej Zolnierkiewicz
  2004-10-27 14:33     ` Mikael Pettersson
  0 siblings, 1 reply; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-27 13:51 UTC (permalink / raw)
  To: CaT; +Cc: torvalds, linux-ide, linux-kernel

http://bugme.osdl.org/show_bug.cgi?id=2494

On Wed, 27 Oct 2004 23:34:31 +1000, CaT <cat@zip.com.au> wrote:
> On Wed, Oct 27, 2004 at 03:07:14PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > <bzolnier@trik.(none)> (04/10/26 1.2192)
> >    [ide] pdc202xx_old: PDC20267 needs the same LBA48 fixup as PDC20265
> 
> What would the symptoms of this bug be? I've got a PDC20267 and I'm
> having a few issues transferring from hde to hdh (ie across two ports)
> it seems. My work at duplicating things seems to work best when I do a
> transfer like that rather then going from say, a totall different
> controller to the pdc (hdh) or even from generated input to the pdc (hdh).
> 
> --
>     Red herrings strewn hither and yon.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-27 13:07 Bartlomiej Zolnierkiewicz
@ 2004-10-27 13:34 ` CaT
  2004-10-27 13:51   ` Bartlomiej Zolnierkiewicz
  2004-10-27 14:29 ` J.A. Magallon
  2004-10-27 16:15 ` Gene Heskett
  2 siblings, 1 reply; 53+ messages in thread
From: CaT @ 2004-10-27 13:34 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: torvalds, linux-ide, linux-kernel

On Wed, Oct 27, 2004 at 03:07:14PM +0200, Bartlomiej Zolnierkiewicz wrote:
> <bzolnier@trik.(none)> (04/10/26 1.2192)
>    [ide] pdc202xx_old: PDC20267 needs the same LBA48 fixup as PDC20265

What would the symptoms of this bug be? I've got a PDC20267 and I'm
having a few issues transferring from hde to hdh (ie across two ports)
it seems. My work at duplicating things seems to work best when I do a
transfer like that rather then going from say, a totall different
controller to the pdc (hdh) or even from generated input to the pdc (hdh).

-- 
    Red herrings strewn hither and yon.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-10-27 13:07 Bartlomiej Zolnierkiewicz
  2004-10-27 13:34 ` CaT
                   ` (2 more replies)
  0 siblings, 3 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-27 13:07 UTC (permalink / raw)
  To: torvalds; +Cc: linux-ide, linux-kernel

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/ide-disk.c         |    1 +
 drivers/ide/ide-dma.c          |   32 ++++++++++++++++++++++++++++++++
 drivers/ide/ide-iops.c         |   12 ------------
 drivers/ide/ide-probe.c        |    2 ++
 drivers/ide/ide-taskfile.c     |   33 ++++-----------------------------
 drivers/ide/pci/aec62xx.c      |   34 +++++++---------------------------
 drivers/ide/pci/amd74xx.c      |    4 ++--
 drivers/ide/pci/atiixp.c       |   34 +++++++---------------------------
 drivers/ide/pci/cmd64x.c       |   34 +++++++---------------------------
 drivers/ide/pci/hpt34x.c       |   38 +++++++++-----------------------------
 drivers/ide/pci/hpt366.c       |   33 +++++++--------------------------
 drivers/ide/pci/it8172.c       |   34 +++++++---------------------------
 drivers/ide/pci/pdc202xx_new.c |   35 +++++++----------------------------
 drivers/ide/pci/pdc202xx_old.c |   38 +++++++++-----------------------------
 drivers/ide/pci/piix.c         |   16 +---------------
 drivers/ide/pci/serverworks.c  |   36 +++++++-----------------------------
 drivers/ide/pci/siimage.c      |   33 ++++++---------------------------
 drivers/ide/pci/sis5513.c      |   34 +++++++---------------------------
 drivers/ide/pci/slc90e66.c     |   33 ++++++---------------------------
 drivers/ide/pci/triflex.c      |   25 ++++++++-----------------
 include/asm-generic/pci.h      |    7 +++++++
 include/asm-ppc64/machdep.h    |    3 +++
 include/asm-ppc64/pci.h        |   11 ++++++++++-
 include/linux/ide.h            |    7 ++-----
 24 files changed, 158 insertions(+), 411 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/10/26 1.2196)
   [ide] remove needless exports from ide-taskfile.c
   
   Also remove unused MAX_DMA define.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/26 1.2195)
   [ide] add ide_use_dma()
   
   Should prevent bugs like the recent piix one in the future.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/26 1.2194)
   [ide] add pci_get_legacy_ide_irq()
   
   This patch adds pci_get_legacy_ide_irq() to the PCI layer for dealing
   with PCI IDE chipsets that use the "legacy mode" IRQ routing, thus
   violating the normal PCI routing.  The generic implementation provides
   IRQ numbers 14 and 15, and it adds a ppc64 specific one with platform
   callbacks so that a plaform can provide different IRQ numbers for "legacy"
   IDE.  I only fixed the amd7xxx.c driver for now, I expect people using
   this interface will slowly fix their drivers (I will fix via soon as I'll
   need it too, and maybe a few others).
   
   Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/26 1.2193)
   [ide] remove unused internal exports from ide core
   
   From: Arjan van de Ven <arjan@fenrus.demon.nl>
   
   ide-iops.c exports a few functions that either have no users or have no
   users AND shouldn't be used by drivers; the patch below unexports them.
   
   -EXPORT_SYMBOL(SELECT_INTERRUPT);
   -EXPORT_SYMBOL(SELECT_MASK);
   -EXPORT_SYMBOL(QUIRK_LIST);
   -EXPORT_SYMBOL(ata_vlb_sync);
   
   only used in the core ide code
   
   -EXPORT_SYMBOL(ata_input_data);
   -EXPORT_SYMBOL(ata_output_data);
   
   drivers should (and do) use the hwif-> function pointer variant of these,
   these functions are internal and used for setting the default hwif->
   function pointers only. No need to export, in fact exporting is only asking
   for accidents
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/26 1.2192)
   [ide] pdc202xx_old: PDC20267 needs the same LBA48 fixup as PDC20265
   
   From: Krzysztof Chmielewski <k.chmielewski@neostrada.pl>
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/26 1.2191)
   [ide] ide-probe: undecoded slave fixup
   
   Undecoded slave fixup is a oneliner patch to ide-probe to
   recognize both of my Maxtor drives that appear to have the same
   serial number, D3000000.
   
   Signed-off-by: tabris@tabris.net
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/26 1.2190)
   [ide] ide-disk: fix /proc/ide/hd?/smart_thresholds
   
   Add missing ->data_phase assignment.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/ide-disk.c	2004-10-26 23:09:56 +02:00
@@ -815,6 +815,7 @@
 	args.tfRegister[IDE_HCYL_OFFSET]	= SMART_HCYL_PASS;
 	args.tfRegister[IDE_COMMAND_OFFSET]	= WIN_SMART;
 	args.command_type			= IDE_DRIVE_TASK_IN;
+	args.data_phase				= TASKFILE_IN;
 	args.handler				= &task_in_intr;
 	(void) smart_enable(drive);
 	return ide_raw_taskfile(drive, &args, buf);
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/ide-dma.c	2004-10-26 23:09:56 +02:00
@@ -681,6 +681,38 @@
 
 EXPORT_SYMBOL(__ide_dma_good_drive);
 
+int ide_use_dma(ide_drive_t *drive)
+{
+	struct hd_driveid *id = drive->id;
+	ide_hwif_t *hwif = drive->hwif;
+
+	/* consult the list of known "bad" drives */
+	if (__ide_dma_bad_drive(drive))
+		return 0;
+
+	/* capable of UltraDMA modes */
+	if (id->field_valid & 4) {
+		if (hwif->ultra_mask & id->dma_ultra)
+			return 1;
+	}
+
+	/* capable of regular DMA modes */
+	if (id->field_valid & 2) {
+		if (hwif->mwdma_mask & id->dma_mword)
+			return 1;
+		if (hwif->swdma_mask & id->dma_1word)
+			return 1;
+	}
+
+	/* consult the list of known "good" drives */
+	if (__ide_dma_good_drive(drive) && id->eide_dma_time < 150)
+		return 1;
+
+	return 0;
+}
+
+EXPORT_SYMBOL_GPL(ide_use_dma);
+
 void ide_dma_verbose(ide_drive_t *drive)
 {
 	struct hd_driveid *id	= drive->id;
diff -Nru a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
--- a/drivers/ide/ide-iops.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/ide-iops.c	2004-10-26 23:09:56 +02:00
@@ -221,24 +221,18 @@
 		HWIF(drive)->OUTB(drive->ctl|2, IDE_CONTROL_REG);
 }
 
-EXPORT_SYMBOL(SELECT_INTERRUPT);
-
 void SELECT_MASK (ide_drive_t *drive, int mask)
 {
 	if (HWIF(drive)->maskproc)
 		HWIF(drive)->maskproc(drive, mask);
 }
 
-EXPORT_SYMBOL(SELECT_MASK);
-
 void QUIRK_LIST (ide_drive_t *drive)
 {
 	if (HWIF(drive)->quirkproc)
 		drive->quirk_list = HWIF(drive)->quirkproc(drive);
 }
 
-EXPORT_SYMBOL(QUIRK_LIST);
-
 /*
  * Some localbus EIDE interfaces require a special access sequence
  * when using 32-bit I/O instructions to transfer data.  We call this
@@ -253,8 +247,6 @@
 	(void) HWIF(drive)->INB(port);
 }
 
-EXPORT_SYMBOL(ata_vlb_sync);
-
 /*
  * This is used for most PIO data transfers *from* the IDE interface
  */
@@ -277,8 +269,6 @@
 	}
 }
 
-EXPORT_SYMBOL(ata_input_data);
-
 /*
  * This is used for most PIO data transfers *to* the IDE interface
  */
@@ -300,8 +290,6 @@
 		hwif->OUTSW(IDE_DATA_REG, buffer, wcount<<1);
 	}
 }
-
-EXPORT_SYMBOL(ata_output_data);
 
 /*
  * The following routines are mainly used by the ATAPI drivers.
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/ide-probe.c	2004-10-26 23:09:56 +02:00
@@ -730,6 +730,8 @@
 			    /* And beware of confused Maxtor drives that go "M0000000000"
 			      "The SN# is garbage in the ID block..." [Eric] */
 			    strncmp(drive->id->serial_no, "M0000000000000000000", 20) &&
+			    /* Same goes for another set of Maxtor drives that say "D3000000" */
+			    strncmp(drive->id->serial_no, "D3000000", 8) &&
 			    strncmp(hwif->drives[0].id->serial_no, drive->id->serial_no, 20) == 0) {
 				printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n");
 				drive->present = 0;
diff -Nru a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
--- a/drivers/ide/ide-taskfile.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/ide-taskfile.c	2004-10-26 23:09:56 +02:00
@@ -63,17 +63,14 @@
 	}
 }
 
-
-void taskfile_input_data (ide_drive_t *drive, void *buffer, u32 wcount)
+static void taskfile_input_data(ide_drive_t *drive, void *buffer, u32 wcount)
 {
 	HWIF(drive)->ata_input_data(drive, buffer, wcount);
 	if (drive->bswap)
 		ata_bswap_data(buffer, wcount);
 }
 
-EXPORT_SYMBOL(taskfile_input_data);
-
-void taskfile_output_data (ide_drive_t *drive, void *buffer, u32 wcount)
+static void taskfile_output_data(ide_drive_t *drive, void *buffer, u32 wcount)
 {
 	if (drive->bswap) {
 		ata_bswap_data(buffer, wcount);
@@ -84,8 +81,6 @@
 	}
 }
 
-EXPORT_SYMBOL(taskfile_output_data);
-
 int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
 {
 	ide_task_t args;
@@ -101,8 +96,6 @@
 	return ide_raw_taskfile(drive, &args, buf);
 }
 
-EXPORT_SYMBOL(taskfile_lib_get_identify);
-
 ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
@@ -470,7 +463,7 @@
 }
 EXPORT_SYMBOL(pre_task_out_intr);
 
-int ide_diag_taskfile (ide_drive_t *drive, ide_task_t *args, unsigned
long data_size, u8 *buf)
+static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args,
unsigned long data_size, u8 *buf)
 {
 	struct request rq;
 
@@ -507,8 +500,6 @@
 	return ide_do_drive_cmd(drive, &rq, ide_wait);
 }
 
-EXPORT_SYMBOL(ide_diag_taskfile);
-
 int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf)
 {
 	return ide_diag_taskfile(drive, args, 0, buf);
@@ -516,10 +507,6 @@
 
 EXPORT_SYMBOL(ide_raw_taskfile);
 
-#define MAX_DMA		(256*SECTOR_WORDS)
-
-ide_startstop_t flagged_taskfile(ide_drive_t *, ide_task_t *);
-
 int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd,
unsigned long arg)
 {
 	ide_task_request_t	*req_task;
@@ -670,8 +657,6 @@
 	return err;
 }
 
-EXPORT_SYMBOL(ide_taskfile_ioctl);
-
 int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature,
u8 sectors, u8 *buf)
 {
 	struct request rq;
@@ -689,8 +674,6 @@
 	return ide_do_drive_cmd(drive, &rq, ide_wait);
 }
 
-EXPORT_SYMBOL(ide_wait_cmd);
-
 /*
  * FIXME : this needs to map into at taskfile. <andre@linux-ide.org>
  */
@@ -748,9 +731,7 @@
 	return err;
 }
 
-EXPORT_SYMBOL(ide_cmd_ioctl);
-
-int ide_wait_cmd_task (ide_drive_t *drive, u8 *buf)
+static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf)
 {
 	struct request rq;
 
@@ -760,8 +741,6 @@
 	return ide_do_drive_cmd(drive, &rq, ide_wait);
 }
 
-EXPORT_SYMBOL(ide_wait_cmd_task);
-
 /*
  * FIXME : this needs to map into at taskfile. <andre@linux-ide.org>
  */
@@ -780,8 +759,6 @@
 	return err;
 }
 
-EXPORT_SYMBOL(ide_task_ioctl);
-
 /*
  * NOTICE: This is additions from IBM to provide a discrete interface,
  * for selective taskregister access operations.  Nice JOB Klaus!!!
@@ -902,5 +879,3 @@
 
 	return ide_started;
 }
-
-EXPORT_SYMBOL(flagged_taskfile);
diff -Nru a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
--- a/drivers/ide/pci/aec62xx.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/aec62xx.c	2004-10-26 23:09:56 +02:00
@@ -189,36 +189,16 @@
 	struct hd_driveid *id	= drive->id;
 
 	if ((id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		aec62xx_tune_drive(drive, 5);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
--- a/drivers/ide/pci/amd74xx.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/amd74xx.c	2004-10-26 23:09:56 +02:00
@@ -416,8 +416,8 @@
 {
 	int i;
 
-	if (!hwif->irq)
-		hwif->irq = hwif->channel ? 15 : 14;
+	if (hwif->irq == 0) /* 0 is bogus but will do for now */
+		hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel);
 
 	hwif->autodma = 0;
 
diff -Nru a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
--- a/drivers/ide/pci/atiixp.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/atiixp.c	2004-10-26 23:09:56 +02:00
@@ -261,36 +261,16 @@
 	drive->init_speed = 0;
 
 	if ((id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				if ((id->field_valid & 2) &&
-				    (!atiixp_config_drive_for_dma(drive)))
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!atiixp_config_drive_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!atiixp_config_drive_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+
+		if (ide_use_dma(drive)) {
+			if (atiixp_config_drive_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL);
 		speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0;
 		hwif->speedproc(drive, speed);
diff -Nru a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
--- a/drivers/ide/pci/cmd64x.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/cmd64x.c	2004-10-26 23:09:56 +02:00
@@ -441,36 +441,16 @@
 	struct hd_driveid *id	= drive->id;
 
 	if ((id != NULL) && ((id->capability & 1) != 0) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if ((id->field_valid & 4) && cmd64x_ratemask(drive)) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		config_chipset_for_pio(drive, 1);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
--- a/drivers/ide/pci/hpt34x.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/hpt34x.c	2004-10-26 23:09:56 +02:00
@@ -130,40 +130,20 @@
 	drive->init_speed = 0;
 
 	if (id && (id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
-		}
+
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
 #ifndef CONFIG_HPT34X_AUTODMA
-		return hwif->ide_dma_off_quietly(drive);
+				return hwif->ide_dma_off_quietly(drive);
 #else
-		return hwif->ide_dma_on(drive);
+				return hwif->ide_dma_on(drive);
 #endif
+		}
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		hpt34x_tune_drive(drive, 255);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
--- a/drivers/ide/pci/hpt366.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/hpt366.c	2004-10-26 23:09:56 +02:00
@@ -460,35 +460,16 @@
 	drive->init_speed = 0;
 
 	if (id && (id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if (id->dma_mword & hwif->mwdma_mask) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		hpt3xx_tune_drive(drive, 5);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c
--- a/drivers/ide/pci/it8172.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/it8172.c	2004-10-26 23:09:56 +02:00
@@ -201,36 +201,16 @@
 	drive->init_speed = 0;
 
 	if (id && (id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = it8172_config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!it8172_config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!it8172_config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+
+		if (ide_use_dma(drive)) {
+			if (it8172_config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		it8172_tune_drive(drive, 5);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
--- a/drivers/ide/pci/pdc202xx_new.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/pdc202xx_new.c	2004-10-26 23:09:56 +02:00
@@ -189,37 +189,16 @@
 	drive->init_speed = 0;
 
 	if (id && (id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			    (id->eide_dma_time < 150)) {
-				goto no_dma_set;
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		hwif->tuneproc(drive, 5);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/pdc202xx_old.c	2004-10-26 23:09:56 +02:00
@@ -334,37 +334,16 @@
 	drive->init_speed = 0;
 
 	if (id && (id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			    (id->eide_dma_time < 150)) {
-				goto no_dma_set;
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		hwif->tuneproc(drive, 5);
 		return hwif->ide_dma_off_quietly(drive);
 	}
@@ -585,7 +564,8 @@
 	struct pci_dev *dev = hwif->pci_dev;
 
 	/* PDC20265 has problems with large LBA48 requests */
-	if (dev->device == PCI_DEVICE_ID_PROMISE_20265)
+	if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) ||
+	    (dev->device == PCI_DEVICE_ID_PROMISE_20265))
 		hwif->rqsize = 256;
 
 	hwif->autodma = 0;
diff -Nru a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
--- a/drivers/ide/pci/piix.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/piix.c	2004-10-26 23:09:56 +02:00
@@ -403,25 +403,11 @@
 
 	if ((id->capability & 1) && drive->autodma) {
 
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-
-		/**
-		 * Try to turn DMA on if:
-		 *  - UDMA or EIDE modes are supported or
-		 *  - drive is a known "good" drive
-		 *
-		 * Checks for best mode supported are down later by
-		 * piix_config_drive_for_dma() -> ide_dma_speed()
-		 */
-		if ((id->field_valid & (4 | 2)) ||
-		    (__ide_dma_good_drive(drive) && id->eide_dma_time < 150)) {
+		if (ide_use_dma(drive)) {
 			if (piix_config_drive_for_dma(drive))
 				return hwif->ide_dma_on(drive);
 		}
 
-		/* For some reason DMA wasn't turned on, so try PIO. */
 		goto fast_ata_pio;
 
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
diff -Nru a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
--- a/drivers/ide/pci/serverworks.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/serverworks.c	2004-10-26 23:09:56 +02:00
@@ -305,38 +305,16 @@
 	drive->init_speed = 0;
 
 	if ((id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			} else
-				/* UDMA disabled by mask, try other DMA modes */
-				goto try_dma_modes;
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto no_dma_set;
+
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		config_chipset_for_pio(drive);
 		//	hwif->tuneproc(drive, 5);
 		return hwif->ide_dma_off_quietly(drive);
diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
--- a/drivers/ide/pci/siimage.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/siimage.c	2004-10-26 23:09:56 +02:00
@@ -420,37 +420,16 @@
 	struct hd_driveid *id	= drive->id;
 
 	if ((id->capability & 1) != 0 && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
 
-		if ((id->field_valid & 4) && siimage_ratemask(drive)) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		config_chipset_for_pio(drive, 1);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
--- a/drivers/ide/pci/sis5513.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/sis5513.c	2004-10-26 23:09:56 +02:00
@@ -671,36 +671,16 @@
 	drive->init_speed = 0;
 
 	if (id && (id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = config_chipset_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!config_chipset_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!config_chipset_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+
+		if (ide_use_dma(drive)) {
+			if (config_chipset_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		sis5513_tune_drive(drive, 5);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
--- a/drivers/ide/pci/slc90e66.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/slc90e66.c	2004-10-26 23:09:56 +02:00
@@ -178,37 +178,16 @@
 	drive->init_speed = 0;
 
 	if (id && (id->capability & 1) && drive->autodma) {
-		/* Consult the list of known "bad" drives */
-		if (__ide_dma_bad_drive(drive))
-			goto fast_ata_pio;
 
-		if (id->field_valid & 4) {
-			if (id->dma_ultra & hwif->ultra_mask) {
-				/* Force if Capable UltraDMA */
-				int dma = slc90e66_config_drive_for_dma(drive);
-				if ((id->field_valid & 2) && !dma)
-					goto try_dma_modes;
-			}
-		} else if (id->field_valid & 2) {
-try_dma_modes:
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-			    (id->dma_1word & hwif->swdma_mask)) {
-				/* Force if Capable regular DMA modes */
-				if (!slc90e66_config_drive_for_dma(drive))
-					goto no_dma_set;
-			}
-		} else if (__ide_dma_good_drive(drive) &&
-			   (id->eide_dma_time < 150)) {
-			/* Consult the list of known "good" drives */
-			if (!slc90e66_config_drive_for_dma(drive))
-				goto no_dma_set;
-		} else {
-			goto fast_ata_pio;
+		if (ide_use_dma(drive)) {
+			if (slc90e66_config_drive_for_dma(drive))
+				return hwif->ide_dma_on(drive);
 		}
-		return hwif->ide_dma_on(drive);
+
+		goto fast_ata_pio;
+
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-no_dma_set:
 		hwif->tuneproc(drive, 5);
 		return hwif->ide_dma_off_quietly(drive);
 	}
diff -Nru a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
--- a/drivers/ide/pci/triflex.c	2004-10-26 23:09:56 +02:00
+++ b/drivers/ide/pci/triflex.c	2004-10-26 23:09:56 +02:00
@@ -118,25 +118,16 @@
 {
 	ide_hwif_t *hwif	= HWIF(drive);
 	struct hd_driveid *id	= drive->id;
-	
-	if (id && (id->capability & 1) && drive->autodma) {
-		if (__ide_dma_bad_drive(drive))
-			goto tune_pio;
-		if (id->field_valid & 2) {
-			if ((id->dma_mword & hwif->mwdma_mask) ||
-				(id->dma_1word & hwif->swdma_mask)) {
-				if (!triflex_config_drive_for_dma(drive))
-					goto tune_pio;
-			}
-		} else 
-			goto tune_pio;
-	} else {
-tune_pio:
-		hwif->tuneproc(drive, 255);
-		return hwif->ide_dma_off_quietly(drive);
+
+	if ((id->capability & 1) && drive->autodma) {
+		if (ide_use_dma(drive)) {
+			if (triflex_config_drive_for_dma(drive))
+				return hwif->ide_dma_on(drive);
+		}
 	}
 
-	return hwif->ide_dma_on(drive);
+	hwif->tuneproc(drive, 255);
+	return hwif->ide_dma_off_quietly(drive);
 }
 
 static void __init init_hwif_triflex(ide_hwif_t *hwif)
diff -Nru a/include/asm-generic/pci.h b/include/asm-generic/pci.h
--- a/include/asm-generic/pci.h	2004-10-26 23:09:56 +02:00
+++ b/include/asm-generic/pci.h	2004-10-26 23:09:56 +02:00
@@ -24,4 +24,11 @@
 
 #define pcibios_scan_all_fns(a, b)	0
 
+#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
+static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
+{
+	return channel ? 15 : 14;
+}
+#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */
+
 #endif
diff -Nru a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
--- a/include/asm-ppc64/machdep.h	2004-10-26 23:09:56 +02:00
+++ b/include/asm-ppc64/machdep.h	2004-10-26 23:09:56 +02:00
@@ -119,6 +119,9 @@
 	/* Check availability of legacy devices like i8042 */
 	int 		(*check_legacy_ioport)(unsigned int baseport);
 
+	/* Get legacy PCI/IDE interrupt mapping */ 
+	int		(*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
+	
 };
 
 extern struct machdep_calls ppc_md;
diff -Nru a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h
--- a/include/asm-ppc64/pci.h	2004-10-26 23:09:56 +02:00
+++ b/include/asm-ppc64/pci.h	2004-10-26 23:09:56 +02:00
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/dma-mapping.h>
+#include <asm/machdep.h>
 #include <asm/scatterlist.h>
 #include <asm/io.h>
 #include <asm/prom.h>
@@ -20,6 +21,8 @@
 #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_MEM		0x10000000
 
+struct pci_dev;
+
 #ifdef CONFIG_PPC_ISERIES
 #define pcibios_scan_all_fns(a, b)	0
 #else
@@ -36,7 +39,13 @@
 	/* We don't do dynamic PCI IRQ allocation */
 }
 
-struct pci_dev;
+#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
+static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
+{
+	if (ppc_md.pci_get_legacy_ide_irq)
+		return ppc_md.pci_get_legacy_ide_irq(dev, channel);
+	return channel ? 15 : 14;
+}
 
 #define HAVE_ARCH_PCI_MWI 1
 static inline int pcibios_prep_mwi(struct pci_dev *dev)
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2004-10-26 23:09:56 +02:00
+++ b/include/linux/ide.h	2004-10-26 23:09:56 +02:00
@@ -1302,9 +1302,6 @@
  */
 extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *);
 
-/* (ide_drive_t *drive, u8 *buf) */
-extern int ide_wait_cmd_task(ide_drive_t *, u8 *);
-
 typedef struct ide_task_s {
 /*
  *	struct hd_drive_task_hdr	tf;
@@ -1349,8 +1346,6 @@
 extern void ata_output_data(ide_drive_t *, void *, u32);
 extern void atapi_input_bytes(ide_drive_t *, void *, u32);
 extern void atapi_output_bytes(ide_drive_t *, void *, u32);
-extern void taskfile_input_data(ide_drive_t *, void *, u32);
-extern void taskfile_output_data(ide_drive_t *, void *, u32);
 
 extern int drive_is_ready(ide_drive_t *);
 extern int wait_for_ready(ide_drive_t *, int /* timeout */);
@@ -1491,6 +1486,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 int __ide_dma_bad_drive(ide_drive_t *);
 int __ide_dma_good_drive(ide_drive_t *);
+int ide_use_dma(ide_drive_t *);
 int __ide_dma_off(ide_drive_t *);
 void ide_dma_verbose(ide_drive_t *);
 
@@ -1516,6 +1512,7 @@
 #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
 
 #else
+static inline int ide_use_dma(ide_drive_t *drive) { return 0; }
 static inline int __ide_dma_off(ide_drive_t *drive) { return 0; }
 static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
 #endif /* CONFIG_BLK_DEV_IDEDMA */

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-24 20:15   ` Bartlomiej Zolnierkiewicz
  2004-10-24 20:51     ` James Cloos
@ 2004-10-25 19:18     ` Bill Davidsen
  1 sibling, 0 replies; 53+ messages in thread
From: Bill Davidsen @ 2004-10-25 19:18 UTC (permalink / raw)
  To: linux-kernel, Bartlomiej Zolnierkiewicz
  Cc: James Cloos, linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:
> On Sun, 24 Oct 2004 12:48:58 -0700, James Cloos <cloos@jhcloos.com> wrote:
> 
>>Are all of the data displayed in /proc/ide/piix et al now available
>>in sysfs?  If so, 'twould've been useful for a small utility -- a
> 
> 
> All these data can be obtained from user-space,
> no need for bloating sysfs.
> 
> 
>>la lsscsi(8) -- that can format that data like the /proc/ide files
>>to have been released before dropping the /proc files....
>>It is a regression to loose convenient access to the controllers'
>>current configs....
> 
> 
> http://home.elka.pw.edu.pl/~bzolnier/atapci/
> 
> released > 2 years ago :)
> 
> works fine but probably needs some cut'n'paste updates

Other than one obvious patch to get rid of all the warnings from putting 
comments after #endif w/o a comment inducer, seems to work...

-- 
    -bill davidsen (davidsen@tmr.com)
"The secret to procrastination is to put things off until the
  last possible moment - but no longer"  -me

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-24 20:15   ` Bartlomiej Zolnierkiewicz
@ 2004-10-24 20:51     ` James Cloos
  2004-10-25 19:18     ` Bill Davidsen
  1 sibling, 0 replies; 53+ messages in thread
From: James Cloos @ 2004-10-24 20:51 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

>>>>> "BZ" == Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> writes:

BZ> All these data can be obtained from user-space, no need for
BZ> bloating sysfs.

Cool.

BZ> http://home.elka.pw.edu.pl/~bzolnier/atapci/

BZ> released > 2 years ago :)

BZ> works fine but probably needs some cut'n'paste updates

Now to get the distributions to pick it up.  I've checked gentoo and
debian (sid); neither has it.

BZ> Most of these /proc files were buggy / inaccurate and keeping them
BZ> had real maintenance cost (hpt366 bug, triflex bug etc.) with
BZ> absolutely no added gain in debugging problems (raw PCI config
BZ> gives much more info).

I always went their first for a quick overview, but since your
atapci(8) provides all of that -- and more, of course -- lspci(8)-
style ubiquity for it is enough. :)

-JimC



^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-24 19:48 ` James Cloos
@ 2004-10-24 20:15   ` Bartlomiej Zolnierkiewicz
  2004-10-24 20:51     ` James Cloos
  2004-10-25 19:18     ` Bill Davidsen
  0 siblings, 2 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-24 20:15 UTC (permalink / raw)
  To: James Cloos; +Cc: linux-ide, linux-kernel

On Sun, 24 Oct 2004 12:48:58 -0700, James Cloos <cloos@jhcloos.com> wrote:
> Are all of the data displayed in /proc/ide/piix et al now available
> in sysfs?  If so, 'twould've been useful for a small utility -- a

All these data can be obtained from user-space,
no need for bloating sysfs.

> la lsscsi(8) -- that can format that data like the /proc/ide files
> to have been released before dropping the /proc files....
> It is a regression to loose convenient access to the controllers'
> current configs....

http://home.elka.pw.edu.pl/~bzolnier/atapci/

released > 2 years ago :)

works fine but probably needs some cut'n'paste updates

Most of these /proc files were buggy / inaccurate and keeping them
had real maintenance cost (hpt366 bug, triflex bug etc.) with absolutely no
added gain in debugging problems (raw PCI config gives much more info).

and yes, this should've been done 2 years ago...

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-24 12:08 Bartlomiej Zolnierkiewicz
@ 2004-10-24 19:48 ` James Cloos
  2004-10-24 20:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 53+ messages in thread
From: James Cloos @ 2004-10-24 19:48 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Are all of the data displayed in /proc/ide/piix et al now available
in sysfs?  If so, 'twould've been useful for a small utility -- a
la lsscsi(8) -- that can format that data like the /proc/ide files
to have been released before dropping the /proc files....

It is a regression to loose convenient access to the controllers'
current configs....

-JimC

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-10-24 12:08 Bartlomiej Zolnierkiewicz
  2004-10-24 19:48 ` James Cloos
  0 siblings, 1 reply; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-24 12:08 UTC (permalink / raw)
  To: torvalds; +Cc: linux-ide, linux-kernel

Kill most of /proc/ide/<chipset> bloat.

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/pci/aec62xx.c      |  110 --------------------------
 drivers/ide/pci/aec62xx.h      |    2 
 drivers/ide/pci/atiixp.c       |  118 ----------------------------
 drivers/ide/pci/cs5520.c       |   74 +-----------------
 drivers/ide/pci/cs5530.c       |   58 --------------
 drivers/ide/pci/hpt366.c       |   72 -----------------
 drivers/ide/pci/hpt366.h       |    2 
 drivers/ide/pci/pdc202xx_new.c |   64 ---------------
 drivers/ide/pci/pdc202xx_new.h |    2 
 drivers/ide/pci/pdc202xx_old.c |  130 -------------------------------
 drivers/ide/pci/pdc202xx_old.h |   37 ---------
 drivers/ide/pci/piix.c         |  167 ----------------------------------------
 drivers/ide/pci/piix.h         |    4 
 drivers/ide/pci/sc1200.c       |   65 ---------------
 drivers/ide/pci/serverworks.c  |  168 -----------------------------------------
 drivers/ide/pci/serverworks.h  |    2 
 drivers/ide/pci/slc90e66.c     |  111 ---------------------------
 17 files changed, 12 insertions(+), 1174 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/10/23 1.2039)
   [ide] slc90e66: kill /proc/ide/slc90e66
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2038)
   [ide] serverworks: kill /proc/ide/svwks
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2037)
   [ide] sc1200: kill /proc/ide/sc1200
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2036)
   [ide] piix: kill /proc/ide/piix
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2035)
   [ide] pdc202xx_old: kill /proc/ide/pdc202xx
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2034)
   [ide] pdc202xx_new: kill /proc/ide/pdcnew
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2033)
   [ide] hpt366: kill /proc/ide/hpt366
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2032)
   [ide] cs5530: kill /proc/ide/cs5530
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2031)
   [ide] cs5520: kill /proc/ide/cs5520
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2030)
   [ide] atiixp: kill /proc/ide/atiixp
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/23 1.2029)
   [ide] aec62xx: kill /proc/ide/aec62xx
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
--- a/drivers/ide/pci/aec62xx.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/aec62xx.c	2004-10-23 23:29:01 +02:00
@@ -18,52 +18,7 @@
 
 #include "aec62xx.h"
 
-#if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 aec62xx_proc = 0;
-
-#define AEC_MAX_DEVS		5
-
-static struct pci_dev *aec_devs[AEC_MAX_DEVS];
-static int n_aec_devs;
-
-static int aec62xx_get_info (char *buffer, char **addr, off_t offset,
int count)
-{
-	char *p = buffer;
-	char *chipset_nums[] = {"error", "error", "error", "error",
-				"error", "error", "850UF",   "860",
-				 "860R",   "865",  "865R", "error"  };
-	int len;
-	int i;
-
-	for (i = 0; i < n_aec_devs; i++) {
-		struct pci_dev *dev	= aec_devs[i];
-		unsigned long iobase = pci_resource_start(dev, 4);
-		u8 c0 = 0, c1 = 0, art	= 0;
-
-		c0 = inb(iobase + 0x02);
-		c1 = inb(iobase + 0x0a);
-
-		p += sprintf(p, "\nController: %d\n", i);
-		p += sprintf(p, "Chipset: AEC%s\n", chipset_nums[dev->device]);
-
-		p += sprintf(p, "--------------- Primary Channel "
-				"---------------- Secondary Channel "
-				"-------------\n");
-		(void) pci_read_config_byte(dev, 0x4a, &art);
-		p += sprintf(p, "                %sabled ",
-			(art&0x02)?" en":"dis");
-		p += sprintf(p, "                        %sabled\n",
-			(art&0x04)?" en":"dis");
-		p += sprintf(p, "--------------- drive0 --------- drive1 "
-				"-------- drive0 ---------- drive1 ------\n");
-		p += sprintf(p, "DMA enabled:    %s              %s ",
-			(c0&0x20)?"yes":"no ",(c0&0x40)?"yes":"no ");
-		p += sprintf(p, "            %s               %s\n",
-			(c1&0x20)?"yes":"no ",(c1&0x40)?"yes":"no ");
-
+#if 0
 		if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
 			(void) pci_read_config_byte(dev, 0x54, &art);
 			p += sprintf(p, "DMA Mode:       %s(%s)",
@@ -79,59 +34,7 @@
 				(c1&0x40)?((art&0xc0)?"UDMA":" DMA"):" PIO",
 				(art&0x80)?"2":(art&0x40)?"1":"0");
 		} else {
-			/*
-			 * case PCI_DEVICE_ID_ARTOP_ATP860:
-			 * case PCI_DEVICE_ID_ARTOP_ATP860R:
-			 * case PCI_DEVICE_ID_ARTOP_ATP865:
-			 * case PCI_DEVICE_ID_ARTOP_ATP865R:
-			 */
-			(void) pci_read_config_byte(dev, 0x44, &art);
-			p += sprintf(p, "DMA Mode:       %s(%s)",
-				(c0&0x20)?((art&0x07)?"UDMA":" DMA"):" PIO",
-				((art&0x07)==0x07)?"6":
-				((art&0x06)==0x06)?"5":
-				((art&0x05)==0x05)?"4":
-				((art&0x04)==0x04)?"3":
-				((art&0x03)==0x03)?"2":
-				((art&0x02)==0x02)?"1":
-				((art&0x01)==0x01)?"0":"?");
-			p += sprintf(p, "          %s(%s)",
-				(c0&0x40)?((art&0x70)?"UDMA":" DMA"):" PIO",
-				((art&0x70)==0x70)?"6":
-				((art&0x60)==0x60)?"5":
-				((art&0x50)==0x50)?"4":
-				((art&0x40)==0x40)?"3":
-				((art&0x30)==0x30)?"2":
-				((art&0x20)==0x20)?"1":
-				((art&0x10)==0x10)?"0":"?");
-			(void) pci_read_config_byte(dev, 0x45, &art);
-			p += sprintf(p, "         %s(%s)",
-				(c1&0x20)?((art&0x07)?"UDMA":" DMA"):" PIO",
-				((art&0x07)==0x07)?"6":
-				((art&0x06)==0x06)?"5":
-				((art&0x05)==0x05)?"4":
-				((art&0x04)==0x04)?"3":
-				((art&0x03)==0x03)?"2":
-				((art&0x02)==0x02)?"1":
-				((art&0x01)==0x01)?"0":"?");
-			p += sprintf(p, "           %s(%s)\n",
-				(c1&0x40)?((art&0x70)?"UDMA":" DMA"):" PIO",
-				((art&0x70)==0x70)?"6":
-				((art&0x60)==0x60)?"5":
-				((art&0x50)==0x50)?"4":
-				((art&0x40)==0x40)?"3":
-				((art&0x30)==0x30)?"2":
-				((art&0x20)==0x20)?"1":
-				((art&0x10)==0x10)?"0":"?");
-		}
-	}
-	/* p - buffer must be less than 4k! */
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-#endif	/* defined(DISPLAY_AEC62xx_TIMINGS) && defined(CONFIG_PROC_FS) */
+#endif
 
 /*
  * TO DO: active tuning and correction of cards without a bios.
@@ -374,15 +277,6 @@
 		pci_write_config_dword(dev, PCI_ROM_ADDRESS,
dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
 		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name,
dev->resource[PCI_ROM_RESOURCE].start);
 	}
-
-#if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
-	aec_devs[n_aec_devs++] = dev;
-
-	if (!aec62xx_proc) {
-		aec62xx_proc = 1;
-		ide_pci_create_host_proc("aec62xx", aec62xx_get_info);
-	}
-#endif /* DISPLAY_AEC62XX_TIMINGS && CONFIG_PROC_FS */
 
 	if (bus_speed <= 33)
 		pci_set_drvdata(dev, (void *) aec6xxx_33_base);
diff -Nru a/drivers/ide/pci/aec62xx.h b/drivers/ide/pci/aec62xx.h
--- a/drivers/ide/pci/aec62xx.h	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/aec62xx.h	2004-10-23 23:29:01 +02:00
@@ -5,8 +5,6 @@
 #include <linux/pci.h>
 #include <linux/ide.h>
 
-#define DISPLAY_AEC62XX_TIMINGS
-
 struct chipset_bus_clock_list_entry {
 	byte		xfer_speed;
 	byte		chipset_settings;
diff -Nru a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
--- a/drivers/ide/pci/atiixp.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/atiixp.c	2004-10-23 23:29:01 +02:00
@@ -47,102 +47,6 @@
 
 static int save_mdma_mode[4];
 
-#define DISPLAY_ATIIXP_TIMINGS
-
-#if defined(DISPLAY_ATIIXP_TIMINGS) && defined(CONFIG_PROC_FS)
-
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 atiixp_proc;
-static struct pci_dev *bmide_dev;
-
-/**
- *	atiixp_get_info		-	fill in /proc for ATIIXP IDE
- *	@buffer: buffer to fill
- *	@addr: address of user start in buffer
- *	@offset: offset into 'file'
- *	@count: buffer count
- *
- *	Output summary data on the tuning.
- */
-
-static int atiixp_get_info(char *buffer, char **addr, off_t offset, int count)
-{
-	char *p = buffer;
-	struct pci_dev *dev = bmide_dev;
-	unsigned long bibma = pci_resource_start(dev, 4);
-	u32 mdma_timing = 0;
-	u16 udma_mode = 0, pio_mode = 0;
-	u8 c0, c1, udma_control = 0;
-
-	p += sprintf(p, "\n                          ATI ");
-	p += sprintf(p, "ATIIXP Ultra100 IDE Chipset.\n");
-
-	pci_read_config_byte(dev, ATIIXP_IDE_UDMA_CONTROL, &udma_control);
-	pci_read_config_word(dev, ATIIXP_IDE_UDMA_MODE, &udma_mode);
-	pci_read_config_word(dev, ATIIXP_IDE_PIO_MODE, &pio_mode);
-	pci_read_config_dword(dev, ATIIXP_IDE_MDMA_TIMING, &mdma_timing);
-
-	/*
-	 * at that point bibma+0x2 et bibma+0xa are byte registers
-	 * to investigate:
-	 */
-	c0 = inb(bibma + 0x02);
-	c1 = inb(bibma + 0x0a);
-
-	p += sprintf(p, "--------------- Primary Channel "
-			"---------------- Secondary Channel "
-			"-------------\n");
-	p += sprintf(p, "                %sabled "
-			"                        %sabled\n",
-			(c0 & 0x80) ? "dis" : " en",
-			(c1 & 0x80) ? "dis" : " en");
-	p += sprintf(p, "--------------- drive0 --------- drive1 "
-			"-------- drive0 ---------- drive1 ------\n");
-	p += sprintf(p, "DMA enabled:    %s              %s "
-			"            %s               %s\n",
-			(c0 & 0x20) ? "yes" : "no ",
-			(c0 & 0x40) ? "yes" : "no ",
-			(c1 & 0x20) ? "yes" : "no ",
-			(c1 & 0x40) ? "yes" : "no " );
-	p += sprintf(p, "UDMA enabled:   %s              %s "
-			"            %s               %s\n",
-			(udma_control & 0x01) ? "yes" : "no ",
-			(udma_control & 0x02) ? "yes" : "no ",
-			(udma_control & 0x04) ? "yes" : "no ",
-			(udma_control & 0x08) ? "yes" : "no " );
-	p += sprintf(p, "UDMA mode:      %c                %c "
-			"              %c                 %c\n",
-			(udma_control & 0x01) ?
-			((udma_mode & 0x07) + 48) : 'X',
-			(udma_control & 0x02) ?
-			(((udma_mode >> 4) & 0x07) + 48) : 'X',
-			(udma_control & 0x04) ?
-			(((udma_mode >> 8) & 0x07) + 48) : 'X',
-			(udma_control & 0x08) ?
-			(((udma_mode >> 12) & 0x07) + 48) : 'X');
-	p += sprintf(p, "MDMA mode:      %c                %c "
-			"              %c                 %c\n",
-			(save_mdma_mode[0] && (c0 & 0x20)) ?
-			((save_mdma_mode[0] & 0xf) + 48) : 'X',
-			(save_mdma_mode[1] && (c0 & 0x40)) ?
-			((save_mdma_mode[1] & 0xf) + 48) : 'X',
-			(save_mdma_mode[2] && (c1 & 0x20)) ?
-			((save_mdma_mode[2] & 0xf) + 48) : 'X',
-			(save_mdma_mode[3] && (c1 & 0x40)) ?
-			((save_mdma_mode[3] & 0xf) + 48) : 'X');
-	p += sprintf(p, "PIO mode:       %c                %c "
-			"              %c                 %c\n",
-			(c0 & 0x20) ? 'X' : ((pio_mode & 0x07) + 48),
-			(c0 & 0x40) ? 'X' : (((pio_mode >> 4) & 0x07) + 48),
-			(c1 & 0x20) ? 'X' : (((pio_mode >> 8) & 0x07) + 48),
-			(c1 & 0x40) ? 'X' : (((pio_mode >> 12) & 0x07) + 48));
-
-	return p - buffer;	/* => must be less than 4k! */
-}
-#endif  /* defined(DISPLAY_ATIIXP_TIMINGS) && defined(CONFIG_PROC_FS) */
-
 /**
  *	atiixp_ratemask		-	compute rate mask for ATIIXP IDE
  *	@drive: IDE drive to compute for
@@ -397,27 +301,6 @@
 }
 
 /**
- *	init_chipset_atiixp	-	set up the ATIIXP chipset
- *	@dev: PCI device to set up
- *	@name: Name of the device
- *
- *	Initialize the PCI device as required. For the ATIIXP this turns
- *	out to be nice and simple
- */
-
-static unsigned int __devinit init_chipset_atiixp(struct pci_dev
*dev, const char *name)
-{
-#if defined(DISPLAY_ATIIXP_TIMINGS) && defined(CONFIG_PROC_FS)
-	if (!atiixp_proc) {
-		atiixp_proc = 1;
-		bmide_dev = dev;
-		ide_pci_create_host_proc("atiixp", atiixp_get_info);
-	}
-#endif /* DISPLAY_ATIIXP_TIMINGS && CONFIG_PROC_FS */
-	return 0;
-}
-
-/**
  *	init_hwif_atiixp		-	fill in the hwif for the ATIIXP
  *	@hwif: IDE interface
  *
@@ -459,7 +342,6 @@
 static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
 	{	/* 0 */
 		.name		= "ATIIXP",
-		.init_chipset	= init_chipset_atiixp,
 		.init_hwif	= init_hwif_atiixp,
 		.channels	= 2,
 		.autodma	= AUTODMA,
diff -Nru a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
--- a/drivers/ide/pci/cs5520.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/cs5520.c	2004-10-23 23:29:01 +02:00
@@ -51,57 +51,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#define DISPLAY_CS5520_TIMINGS
-
-#if defined(DISPLAY_CS5520_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 cs5520_proc = 0;
-static struct pci_dev *bmide_dev;
-
-static int cs5520_get_info(char *buffer, char **addr, off_t offset, int count)
-{
-	char *p = buffer;
-	unsigned long bmiba = pci_resource_start(bmide_dev, 2);
-	int len;
-	u8 c0 = 0, c1 = 0;
-	u16 reg16;
-	u32 reg32;
-
-	/*
-	 * at that point bibma+0x2 et bibma+0xa are byte registers
-	 * to investigate:
-	 */
-	c0 = inb(bmiba + 0x02);
-	c1 = inb(bmiba + 0x0a);
-	
-	p += sprintf(p, "\nCyrix CS55x0 IDE\n");
-	p += sprintf(p, "--------------- Primary Channel "
-			"---------------- Secondary Channel "
-			"-------------\n");
-	p += sprintf(p, "                %sabled "
-			"                        %sabled\n",
-			(c0&0x80) ? "dis" : " en",
-			(c1&0x80) ? "dis" : " en");
-			
-	p += sprintf(p, "\n\nTimings: \n");
-	
-	pci_read_config_word(bmide_dev, 0x62, &reg16);
-	p += sprintf(p, "8bit CAT/CRT   : %04x\n", reg16);
-	pci_read_config_dword(bmide_dev, 0x64, &reg32);
-	p += sprintf(p, "16bit Primary  : %08x\n", reg32);
-	pci_read_config_dword(bmide_dev, 0x68, &reg32);
-	p += sprintf(p, "16bit Secondary: %08x\n", reg32);
-	
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-
-#endif
-
 struct pio_clocks
 {
 	int address;
@@ -144,12 +93,14 @@
 	printk("PIO clocking = %d\n", pio);
 	
 	/* FIXME: if DMA = 1 do we need to set the DMA bit here ? */
-	
-	/* 8bit command timing for channel */
+
+	/* 8bit CAT/CRT - 8bit command timing for channel */
 	pci_write_config_byte(pdev, 0x62 + controller, 
 		(cs5520_pio_clocks[pio].recovery << 4) |
 		(cs5520_pio_clocks[pio].assert));
-		
+
+	/* 0x64 - 16bit Primary, 0x68 - 16bit Secondary */
+
 	/* FIXME: should these use address ? */
 	/* Data read timing */
 	pci_write_config_byte(pdev, 0x64 + 4*controller + (drive->dn&1),
@@ -188,19 +139,6 @@
 	/* Then tell the core to use DMA operations */
 	return hwif->ide_dma_on(drive);
 }
-	
-	
-static unsigned int __devinit init_chipset_cs5520(struct pci_dev
*dev, const char *name)
-{
-#if defined(DISPLAY_CS5520_TIMINGS) && defined(CONFIG_PROC_FS)
-	if (!cs5520_proc) {
-		cs5520_proc = 1;
-		bmide_dev = dev;
-		ide_pci_create_host_proc("cs5520", cs5520_get_info);
-	}
-#endif /* DISPLAY_CS5520_TIMINGS && CONFIG_PROC_FS */
-	return 0;
-}
 
 /*
  *	We provide a callback for our nonstandard DMA location
@@ -255,7 +193,6 @@
 #define DECLARE_CS_DEV(name_str)				\
 	{							\
 		.name		= name_str,			\
-		.init_chipset	= init_chipset_cs5520,		\
 		.init_setup_dma = cs5520_init_setup_dma,	\
 		.init_hwif	= init_hwif_cs5520,		\
 		.channels	= 2,				\
@@ -294,7 +231,6 @@
 		printk(KERN_WARNING "cs5520: No suitable DMA available.\n");
 		return -ENODEV;
 	}
-	init_chipset_cs5520(dev, d->name);
 
 	index.all = 0xf0f0;
 
diff -Nru a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
--- a/drivers/ide/pci/cs5530.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/cs5530.c	2004-10-23 23:29:01 +02:00
@@ -31,56 +31,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#define DISPLAY_CS5530_TIMINGS
-
-#if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 cs5530_proc = 0;
-
-static struct pci_dev *bmide_dev;
-
-static int cs5530_get_info (char *buffer, char **addr, off_t offset, int count)
-{
-	char *p = buffer;
-	unsigned long bibma = pci_resource_start(bmide_dev, 4);
-	u8  c0 = 0, c1 = 0;
-
-	/*
-	 * at that point bibma+0x2 et bibma+0xa are byte registers
-	 * to investigate:
-	 */
-
-	c0 = inb_p((u16)bibma + 0x02);
-	c1 = inb_p((u16)bibma + 0x0a);
-
-	p += sprintf(p, "\n                                "
-			"Cyrix 5530 Chipset.\n");
-	p += sprintf(p, "--------------- Primary Channel "
-			"---------------- Secondary Channel "
-			"-------------\n");
-	p += sprintf(p, "                %sabled "
-			"                        %sabled\n",
-			(c0&0x80) ? "dis" : " en",
-			(c1&0x80) ? "dis" : " en");
-	p += sprintf(p, "--------------- drive0 --------- drive1 "
-			"-------- drive0 ---------- drive1 ------\n");
-	p += sprintf(p, "DMA enabled:    %s              %s "
-			"            %s               %s\n",
-			(c0&0x20) ? "yes" : "no ",
-			(c0&0x40) ? "yes" : "no ",
-			(c1&0x20) ? "yes" : "no ",
-			(c1&0x40) ? "yes" : "no " );
-
-	p += sprintf(p, "UDMA\n");
-	p += sprintf(p, "DMA\n");
-	p += sprintf(p, "PIO\n");
-
-	return p-buffer;
-}
-#endif /* DISPLAY_CS5530_TIMINGS && CONFIG_PROC_FS */
-
 /**
  *	cs5530_xfer_set_mode	-	set a new transfer mode at the drive
  *	@drive: drive to tune
@@ -271,14 +221,6 @@
 {
 	struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
 	unsigned long flags;
-
-#if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS)
-	if (!cs5530_proc) {
-		cs5530_proc = 1;
-		bmide_dev = dev;
-		ide_pci_create_host_proc("cs5530", cs5530_get_info);
-	}
-#endif /* DISPLAY_CS5530_TIMINGS && CONFIG_PROC_FS */
 
 	dev = NULL;
 	while ((dev = pci_find_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev))
!= NULL) {
diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
--- a/drivers/ide/pci/hpt366.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/hpt366.c	2004-10-23 23:29:01 +02:00
@@ -72,49 +72,6 @@
 
 #include "hpt366.h"
 
-#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-#endif  /* defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) */
-
-static unsigned int hpt_revision(struct pci_dev *dev);
-static unsigned int hpt_minimum_revision(struct pci_dev *dev, int revision);
-
-#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
-
-static u8 hpt366_proc = 0;
-static struct pci_dev *hpt_devs[HPT366_MAX_DEVS];
-static int n_hpt_devs;
-
-static int hpt366_get_info (char *buffer, char **addr, off_t offset, int count)
-{
-	char *p	= buffer;
-	char *chipset_nums[] = {"366", "366",  "368",
-				"370", "370A", "372",
-				"302", "371",  "374" };
-	int i, len;
-
-	p += sprintf(p, "\n                             "
-		"HighPoint HPT366/368/370/372/374\n");
-	for (i = 0; i < n_hpt_devs; i++) {
-		struct pci_dev *dev = hpt_devs[i];
-		unsigned long iobase = dev->resource[4].start;
-		u32 class_rev = hpt_revision(dev);
-		u8 c0, c1;
-
-		p += sprintf(p, "\nController: %d\n", i);
-		p += sprintf(p, "Chipset: HPT%s\n", chipset_nums[class_rev]);
-		p += sprintf(p, "--------------- Primary Channel "
-				"--------------- Secondary Channel "
-				"--------------\n");
-
-		/* get the bus master status registers */
-		c0 = inb(iobase + 0x2);
-		c1 = inb(iobase + 0xa);
-		p += sprintf(p, "Enabled:        %s"
-				"                             %s\n",
-			(c0 & 0x80) ? "no" : "yes",
-			(c1 & 0x80) ? "no" : "yes");
 #if 0
 		if (hpt_minimum_revision(dev, 3)) {
 			u8 cbl;
@@ -128,16 +85,6 @@
 				(cbl & 0x01) ? 33 : 66);
 			p += sprintf(p, "\n");
 		}
-#endif
-		p += sprintf(p, "--------------- drive0 --------- drive1 "
-				"------- drive0 ---------- drive1 -------\n");
-		p += sprintf(p, "DMA capable:    %s              %s" 
-				"            %s               %s\n",
-			(c0 & 0x20) ? "yes" : "no ", 
-			(c0 & 0x40) ? "yes" : "no ",
-			(c1 & 0x20) ? "yes" : "no ", 
-			(c1 & 0x40) ? "yes" : "no ");
-
 		{
 			u8 c2, c3;
 			/* older revs don't have these registers mapped 
@@ -159,15 +106,7 @@
 					(c3 & 0x80) ? "PIO " : "off ");
 		}
 	}
-	p += sprintf(p, "\n");
-
-	/* p - buffer must be less than 4k! */
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-#endif  /* defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) */
+#endif
 
 static u32 hpt_revision (struct pci_dev *dev)
 {
@@ -1105,15 +1044,6 @@
 	}
 	if (ret)
 		return ret;
-	
-#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
-	hpt_devs[n_hpt_devs++] = dev;
-
-	if (!hpt366_proc) {
-		hpt366_proc = 1;
-		ide_pci_create_host_proc("hpt366", hpt366_get_info);
-	}
-#endif /* DISPLAY_HPT366_TIMINGS && CONFIG_PROC_FS */
 
 	return dev->irq;
 }
diff -Nru a/drivers/ide/pci/hpt366.h b/drivers/ide/pci/hpt366.h
--- a/drivers/ide/pci/hpt366.h	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/hpt366.h	2004-10-23 23:29:01 +02:00
@@ -5,8 +5,6 @@
 #include <linux/pci.h>
 #include <linux/ide.h>
 
-#define DISPLAY_HPT366_TIMINGS
-
 /* various tuning parameters */
 #define HPT_RESET_STATE_ENGINE
 #undef HPT_DELAY_INTERRUPT
diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
--- a/drivers/ide/pci/pdc202xx_new.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/pdc202xx_new.c	2004-10-23 23:29:01 +02:00
@@ -41,61 +41,6 @@
 
 #define PDC202_DEBUG_CABLE	0
 
-#if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 pdcnew_proc = 0;
-#define PDC202_MAX_DEVS		5
-static struct pci_dev *pdc202_devs[PDC202_MAX_DEVS];
-static int n_pdc202_devs;
-
-static char * pdcnew_info(char *buf, struct pci_dev *dev)
-{
-	char *p = buf;
-
-	p += sprintf(p, "\n                                ");
-	switch(dev->device) {
-		case PCI_DEVICE_ID_PROMISE_20277:
-			p += sprintf(p, "SBFastTrak 133 Lite"); break;
-		case PCI_DEVICE_ID_PROMISE_20276:
-			p += sprintf(p, "MBFastTrak 133 Lite"); break;
-		case PCI_DEVICE_ID_PROMISE_20275:
-			p += sprintf(p, "MBUltra133"); break;
-		case PCI_DEVICE_ID_PROMISE_20271:
-			p += sprintf(p, "FastTrak TX2000"); break;
-		case PCI_DEVICE_ID_PROMISE_20270:
-			p += sprintf(p, "FastTrak LP/TX2/TX4"); break;
-		case PCI_DEVICE_ID_PROMISE_20269:
-			p += sprintf(p, "Ultra133 TX2"); break;
-		case PCI_DEVICE_ID_PROMISE_20268:
-			p += sprintf(p, "Ultra100 TX2"); break;
-		default:
-			p += sprintf(p, "Ultra series"); break;
-			break;
-	}
-	p += sprintf(p, " Chipset.\n");
-	return (char *)p;
-}
-
-static int pdcnew_get_info (char *buffer, char **addr, off_t offset, int count)
-{
-	char *p = buffer;
-	int i, len;
-
-	for (i = 0; i < n_pdc202_devs; i++) {
-		struct pci_dev *dev	= pdc202_devs[i];
-		p = pdcnew_info(buffer, dev);
-	}
-	/* p - buffer must be less than 4k! */
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-#endif  /* defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) */
-
-
 static u8 pdcnew_ratemask (ide_drive_t *drive)
 {
 	u8 mode;
@@ -416,15 +361,6 @@
 #ifdef CONFIG_PPC_PMAC
 	apple_kiwi_init(dev);
 #endif
-
-#if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS)
-	pdc202_devs[n_pdc202_devs++] = dev;
-
-	if (!pdcnew_proc) {
-		pdcnew_proc = 1;
-		ide_pci_create_host_proc("pdcnew", pdcnew_get_info);
-	}
-#endif /* DISPLAY_PDC202XX_TIMINGS && CONFIG_PROC_FS */
 
 	return dev->irq;
 }
diff -Nru a/drivers/ide/pci/pdc202xx_new.h b/drivers/ide/pci/pdc202xx_new.h
--- a/drivers/ide/pci/pdc202xx_new.h	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/pdc202xx_new.h	2004-10-23 23:29:01 +02:00
@@ -43,8 +43,6 @@
 		set_2regs(0x13,(c));			\
 	} while(0)
 
-#define DISPLAY_PDC202XX_TIMINGS
-
 static void init_setup_pdcnew(struct pci_dev *, ide_pci_device_t *);
 static void init_setup_pdc20270(struct pci_dev *, ide_pci_device_t *);
 static void init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d);
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/pdc202xx_old.c	2004-10-23 23:29:01 +02:00
@@ -50,68 +50,14 @@
 
 #define PDC202_DEBUG_CABLE	0
 
-#if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 pdc202xx_proc = 0;
-#define PDC202_MAX_DEVS		5
-static struct pci_dev *pdc202_devs[PDC202_MAX_DEVS];
-static int n_pdc202_devs;
-
-static char * pdc202xx_info (char *buf, struct pci_dev *dev)
-{
-	char *p = buf;
-
+#if 0
 	unsigned long bibma  = pci_resource_start(dev, 4);
-	u32 reg60h = 0, reg64h = 0, reg68h = 0, reg6ch = 0;
-	u16 reg50h = 0, pmask = (1<<10), smask = (1<<11);
 	u8 hi = 0, lo = 0;
 
-        /*
-         * at that point bibma+0x2 et bibma+0xa are byte registers
-         * to investigate:
-         */
-	u8 c0	= inb_p((u16)bibma + 0x02);
-	u8 c1	= inb_p((u16)bibma + 0x0a);
-
-	u8 sc11	= inb_p((u16)bibma + 0x11);
-	u8 sc1a	= inb_p((u16)bibma + 0x1a);
-	u8 sc1b	= inb_p((u16)bibma + 0x1b);
 	u8 sc1c	= inb_p((u16)bibma + 0x1c); 
-	u8 sc1d	= inb_p((u16)bibma + 0x1d);
 	u8 sc1e	= inb_p((u16)bibma + 0x1e);
 	u8 sc1f	= inb_p((u16)bibma + 0x1f);
 
-	pci_read_config_word(dev, 0x50, &reg50h);
-	pci_read_config_dword(dev, 0x60, &reg60h);
-	pci_read_config_dword(dev, 0x64, &reg64h);
-	pci_read_config_dword(dev, 0x68, &reg68h);
-	pci_read_config_dword(dev, 0x6c, &reg6ch);
-
-	p += sprintf(p, "\n                                ");
-	switch(dev->device) {
-		case PCI_DEVICE_ID_PROMISE_20267:
-			p += sprintf(p, "Ultra100"); break;
-		case PCI_DEVICE_ID_PROMISE_20265:
-			p += sprintf(p, "Ultra100 on M/B"); break;
-		case PCI_DEVICE_ID_PROMISE_20263:
-			p += sprintf(p, "FastTrak 66"); break;
-		case PCI_DEVICE_ID_PROMISE_20262:
-			p += sprintf(p, "Ultra66"); break;
-		case PCI_DEVICE_ID_PROMISE_20246:
-			p += sprintf(p, "Ultra33");
-			reg50h |= 0x0c00;
-			break;
-		default:
-			p += sprintf(p, "Ultra Series"); break;
-	}
-	p += sprintf(p, " Chipset.\n");
-
-	p += sprintf(p, "------------------------------- General Status "
-			"---------------------------------\n");
-	p += sprintf(p, "Burst Mode                           : %sabled\n",
-		(sc1f & 0x01) ? "en" : "dis");
 	p += sprintf(p, "Host Mode                            : %s\n",
 		(sc1f & 0x08) ? "Tri-Stated" : "Normal");
 	p += sprintf(p, "Bus Clocking                         : %s\n",
@@ -126,70 +72,7 @@
 	SPLIT_BYTE(sc1e, hi, lo);
 	p += sprintf(p, "Status Polling Period                : %d\n", hi);
 	p += sprintf(p, "Interrupt Check Status Polling Delay : %d\n", lo);
-	p += sprintf(p, "--------------- Primary Channel "
-			"---------------- Secondary Channel "
-			"-------------\n");
-	p += sprintf(p, "                %s                         %s\n",
-		(c0&0x80)?"disabled":"enabled ",
-		(c1&0x80)?"disabled":"enabled ");
-	p += sprintf(p, "66 Clocking     %s                         %s\n",
-		(sc11&0x02)?"enabled ":"disabled",
-		(sc11&0x08)?"enabled ":"disabled");
-	p += sprintf(p, "           Mode %s                      Mode %s\n",
-		(sc1a & 0x01) ? "MASTER" : "PCI   ",
-		(sc1b & 0x01) ? "MASTER" : "PCI   ");
-	p += sprintf(p, "                %s                     %s\n",
-		(sc1d & 0x08) ? "Error       " :
-		((sc1d & 0x05) == 0x05) ? "Not My INTR " :
-		(sc1d & 0x04) ? "Interrupting" :
-		(sc1d & 0x02) ? "FIFO Full   " :
-		(sc1d & 0x01) ? "FIFO Empty  " : "????????????",
-		(sc1d & 0x80) ? "Error       " :
-		((sc1d & 0x50) == 0x50) ? "Not My INTR " :
-		(sc1d & 0x40) ? "Interrupting" :
-		(sc1d & 0x20) ? "FIFO Full   " :
-		(sc1d & 0x10) ? "FIFO Empty  " : "????????????");
-	p += sprintf(p, "--------------- drive0 --------- drive1 "
-			"-------- drive0 ---------- drive1 ------\n");
-	p += sprintf(p, "DMA enabled:    %s              %s "
-			"            %s               %s\n",
-		(c0&0x20)?"yes":"no ", (c0&0x40)?"yes":"no ",
-		(c1&0x20)?"yes":"no ", (c1&0x40)?"yes":"no ");
-	p += sprintf(p, "DMA Mode:       %s           %s "
-			"         %s            %s\n",
-		pdc202xx_ultra_verbose(reg60h, (reg50h & pmask)),
-		pdc202xx_ultra_verbose(reg64h, (reg50h & pmask)),
-		pdc202xx_ultra_verbose(reg68h, (reg50h & smask)),
-		pdc202xx_ultra_verbose(reg6ch, (reg50h & smask)));
-	p += sprintf(p, "PIO Mode:       %s            %s "
-			"          %s            %s\n",
-		pdc202xx_pio_verbose(reg60h),
-		pdc202xx_pio_verbose(reg64h),
-		pdc202xx_pio_verbose(reg68h),
-		pdc202xx_pio_verbose(reg6ch));
-#if 0
-	p += sprintf(p, "--------------- Can ATAPI DMA ---------------\n");
 #endif
-	return (char *)p;
-}
-
-static int pdc202xx_get_info (char *buffer, char **addr, off_t
offset, int count)
-{
-	char *p = buffer;
-	int i, len;
-
-	for (i = 0; i < n_pdc202_devs; i++) {
-		struct pci_dev *dev	= pdc202_devs[i];
-		p = pdc202xx_info(buffer, dev);
-	}
-	/* p - buffer must be less than 4k! */
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-#endif  /* defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) */
-
 
 static u8 pdc202xx_ratemask (ide_drive_t *drive)
 {
@@ -546,11 +429,13 @@
 	u8 sc1d			= hwif->INB((high_16 + 0x001d));
 
 	if (hwif->channel) {
+		/* bit7: Error, bit6: Interrupting, bit5: FIFO Full, bit4: FIFO Empty */
 		if ((sc1d & 0x50) == 0x50)
 			goto somebody_else;
 		else if ((sc1d & 0x40) == 0x40)
 			return (dma_stat & 4) == 4;
 	} else {
+		/* bit3: Error, bit2: Interrupting, bit1: FIFO Full, bit0: FIFO Empty */
 		if ((sc1d & 0x05) == 0x05)
 			goto somebody_else;
 		else if ((sc1d & 0x04) == 0x04)
@@ -667,15 +552,6 @@
 		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n",
 			name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
-
-#if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS)
-	pdc202_devs[n_pdc202_devs++] = dev;
-
-	if (!pdc202xx_proc) {
-		pdc202xx_proc = 1;
-		ide_pci_create_host_proc("pdc202xx", pdc202xx_get_info);
-	}
-#endif /* DISPLAY_PDC202XX_TIMINGS && CONFIG_PROC_FS */
 
 	/*
 	 * software reset -  this is required because the bios
diff -Nru a/drivers/ide/pci/pdc202xx_old.h b/drivers/ide/pci/pdc202xx_old.h
--- a/drivers/ide/pci/pdc202xx_old.h	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/pdc202xx_old.h	2004-10-23 23:29:01 +02:00
@@ -23,41 +23,6 @@
 	NULL
 };
 
-static inline u8 *pdc202xx_pio_verbose (u32 drive_pci)
-{
-	if ((drive_pci & 0x000ff000) == 0x000ff000) return("NOTSET");
-	if ((drive_pci & 0x00000401) == 0x00000401) return("PIO 4");
-	if ((drive_pci & 0x00000602) == 0x00000602) return("PIO 3");
-	if ((drive_pci & 0x00000803) == 0x00000803) return("PIO 2");
-	if ((drive_pci & 0x00000C05) == 0x00000C05) return("PIO 1");
-	if ((drive_pci & 0x00001309) == 0x00001309) return("PIO 0");
-	return("PIO ?");
-}
-
-static inline u8 *pdc202xx_dma_verbose (u32 drive_pci)
-{
-	if ((drive_pci & 0x00036000) == 0x00036000) return("MWDMA 2");
-	if ((drive_pci & 0x00046000) == 0x00046000) return("MWDMA 1");
-	if ((drive_pci & 0x00056000) == 0x00056000) return("MWDMA 0");
-	if ((drive_pci & 0x00056000) == 0x00056000) return("SWDMA 2");
-	if ((drive_pci & 0x00068000) == 0x00068000) return("SWDMA 1");
-	if ((drive_pci & 0x000BC000) == 0x000BC000) return("SWDMA 0");
-	return("PIO---");
-}
-
-static inline u8 *pdc202xx_ultra_verbose (u32 drive_pci, u16 slow_cable)
-{
-	if ((drive_pci & 0x000ff000) == 0x000ff000)
-		return("NOTSET");
-	if ((drive_pci & 0x00012000) == 0x00012000)
-		return((slow_cable) ? "UDMA 2" : "UDMA 4");
-	if ((drive_pci & 0x00024000) == 0x00024000)
-		return((slow_cable) ? "UDMA 1" : "UDMA 3");
-	if ((drive_pci & 0x00036000) == 0x00036000)
-		return("UDMA 0");
-	return(pdc202xx_dma_verbose(drive_pci));
-}
-
 /* A Register */
 #define	SYNC_ERRDY_EN	0xC0
 
@@ -97,8 +62,6 @@
 #define	MC2		0x04	/* DMA"C" timing */
 #define	MC1		0x02	/* DMA"C" timing */
 #define	MC0		0x01	/* DMA"C" timing */
-
-#define DISPLAY_PDC202XX_TIMINGS
 
 static void init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d);
 static void init_setup_pdc20265(struct pci_dev *, ide_pci_device_t *);
diff -Nru a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
--- a/drivers/ide/pci/piix.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/piix.c	2004-10-23 23:29:01 +02:00
@@ -106,165 +106,6 @@
 #include "piix.h"
 
 static int no_piix_dma;
-#if defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 piix_proc = 0;
-#define PIIX_MAX_DEVS		5
-static struct pci_dev *piix_devs[PIIX_MAX_DEVS];
-static int n_piix_devs;
-
-/**
- *	piix_get_info		-	fill in /proc for PIIX ide
- *	@buffer: buffer to fill
- *	@addr: address of user start in buffer
- *	@offset: offset into 'file'
- *	@count: buffer count
- *
- *	Walks the PIIX devices and outputs summary data on the tuning and
- *	anything else that will help with debugging
- */
- 
-static int piix_get_info (char *buffer, char **addr, off_t offset, int count)
-{
-	char *p = buffer;
-	int i;
-
-	for (i = 0; i < n_piix_devs; i++) {
-		struct pci_dev *dev	= piix_devs[i];
-		unsigned long bibma = pci_resource_start(dev, 4);
-	        u16 reg40 = 0, psitre = 0, reg42 = 0, ssitre = 0;
-		u8  c0 = 0, c1 = 0, reg54 = 0, reg55 = 0;
-		u8  reg44 = 0, reg48 = 0, reg4a = 0, reg4b = 0;
-
-		p += sprintf(p, "\nController: %d\n", i);
-		p += sprintf(p, "\n                                Intel ");
-		switch(dev->device) {
-			case PCI_DEVICE_ID_INTEL_82801EB_1:
-				p += sprintf(p, "PIIX4 SATA 150 ");
-				break;
-			case PCI_DEVICE_ID_INTEL_82801BA_8:
-			case PCI_DEVICE_ID_INTEL_82801BA_9:
-			case PCI_DEVICE_ID_INTEL_82801CA_10:
-			case PCI_DEVICE_ID_INTEL_82801CA_11:
-			case PCI_DEVICE_ID_INTEL_82801DB_10:
-			case PCI_DEVICE_ID_INTEL_82801DB_11:
-			case PCI_DEVICE_ID_INTEL_82801EB_11:
-			case PCI_DEVICE_ID_INTEL_82801E_11:
-			case PCI_DEVICE_ID_INTEL_ESB_2:
-			case PCI_DEVICE_ID_INTEL_ICH6_19:
-				p += sprintf(p, "PIIX4 Ultra 100 ");
-				break;
-			case PCI_DEVICE_ID_INTEL_82372FB_1:
-			case PCI_DEVICE_ID_INTEL_82801AA_1:
-				p += sprintf(p, "PIIX4 Ultra 66 ");
-				break;
-			case PCI_DEVICE_ID_INTEL_82451NX:
-			case PCI_DEVICE_ID_INTEL_82801AB_1:
-			case PCI_DEVICE_ID_INTEL_82443MX_1:
-			case PCI_DEVICE_ID_INTEL_82371AB:
-				p += sprintf(p, "PIIX4 Ultra 33 ");
-				break;
-			case PCI_DEVICE_ID_INTEL_82371SB_1:
-				p += sprintf(p, "PIIX3 ");
-				break;
-			case PCI_DEVICE_ID_INTEL_82371MX:
-				p += sprintf(p, "MPIIX ");
-				break;
-			case PCI_DEVICE_ID_INTEL_82371FB_1:
-			case PCI_DEVICE_ID_INTEL_82371FB_0:
-			default:
-				p += sprintf(p, "PIIX ");
-				break;
-		}
-		p += sprintf(p, "Chipset.\n");
-
-		if (dev->device == PCI_DEVICE_ID_INTEL_82371MX)
-			continue;
-
-		pci_read_config_word(dev, 0x40, &reg40);
-		pci_read_config_word(dev, 0x42, &reg42);
-		pci_read_config_byte(dev, 0x44, &reg44);
-		pci_read_config_byte(dev, 0x48, &reg48);
-		pci_read_config_byte(dev, 0x4a, &reg4a);
-		pci_read_config_byte(dev, 0x4b, &reg4b);
-		pci_read_config_byte(dev, 0x54, &reg54);
-		pci_read_config_byte(dev, 0x55, &reg55);
-
-		psitre = (reg40 & 0x4000) ? 1 : 0;
-		ssitre = (reg42 & 0x4000) ? 1 : 0;
-
-		/*
-		 * at that point bibma+0x2 et bibma+0xa are byte registers
-		 * to investigate:
-		 */
-		c0 = inb(bibma + 0x02);
-		c1 = inb(bibma + 0x0a);
-
-		p += sprintf(p, "--------------- Primary Channel "
-				"---------------- Secondary Channel "
-				"-------------\n");
-		p += sprintf(p, "                %sabled "
-				"                        %sabled\n",
-				(c0&0x80) ? "dis" : " en",
-				(c1&0x80) ? "dis" : " en");
-		p += sprintf(p, "--------------- drive0 --------- drive1 "
-				"-------- drive0 ---------- drive1 ------\n");
-		p += sprintf(p, "DMA enabled:    %s              %s "
-				"            %s               %s\n",
-				(c0&0x20) ? "yes" : "no ",
-				(c0&0x40) ? "yes" : "no ",
-				(c1&0x20) ? "yes" : "no ",
-				(c1&0x40) ? "yes" : "no " );
-		p += sprintf(p, "UDMA enabled:   %s              %s "
-				"            %s               %s\n",
-				(reg48&0x01) ? "yes" : "no ",
-				(reg48&0x02) ? "yes" : "no ",
-				(reg48&0x04) ? "yes" : "no ",
-				(reg48&0x08) ? "yes" : "no " );
-		p += sprintf(p, "UDMA enabled:   %s                %s "
-				"              %s                 %s\n",
-				((reg54&0x11) &&
-				 (reg55&0x10) && (reg4a&0x01)) ? "5" :
-				((reg54&0x11) && (reg4a&0x02)) ? "4" :
-				((reg54&0x11) && (reg4a&0x01)) ? "3" :
-				(reg4a&0x02) ? "2" :
-				(reg4a&0x01) ? "1" :
-				(reg4a&0x00) ? "0" : "X",
-				((reg54&0x22) &&
-				 (reg55&0x20) && (reg4a&0x10)) ? "5" :
-				((reg54&0x22) && (reg4a&0x20)) ? "4" :
-				((reg54&0x22) && (reg4a&0x10)) ? "3" :
-				(reg4a&0x20) ? "2" :
-				(reg4a&0x10) ? "1" :
-				(reg4a&0x00) ? "0" : "X",
-				((reg54&0x44) &&
-				 (reg55&0x40) && (reg4b&0x03)) ? "5" :
-				((reg54&0x44) && (reg4b&0x02)) ? "4" :
-				((reg54&0x44) && (reg4b&0x01)) ? "3" :
-				(reg4b&0x02) ? "2" :
-				(reg4b&0x01) ? "1" :
-				(reg4b&0x00) ? "0" : "X",
-				((reg54&0x88) &&
-				 (reg55&0x80) && (reg4b&0x30)) ? "5" :
-				((reg54&0x88) && (reg4b&0x20)) ? "4" :
-				((reg54&0x88) && (reg4b&0x10)) ? "3" :
-				(reg4b&0x20) ? "2" :
-				(reg4b&0x10) ? "1" :
-				(reg4b&0x00) ? "0" : "X");
-
-		p += sprintf(p, "UDMA\n");
-		p += sprintf(p, "DMA\n");
-		p += sprintf(p, "PIO\n");
-
-		/*
-		 * FIXME.... Add configuration junk data....blah blah......
-		 */
-	}
-	return p-buffer;	 /* => must be less than 4k! */
-}
-#endif  /* defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS) */
 
 /**
  *	piix_ratemask		-	compute rate mask for PIIX IDE
@@ -627,14 +468,6 @@
 			break;
 	}
 
-#if defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS)
-	piix_devs[n_piix_devs++] = dev;
-
-	if (!piix_proc) {
-		piix_proc = 1;
-		ide_pci_create_host_proc("piix", piix_get_info);
-	}
-#endif /* DISPLAY_PIIX_TIMINGS && CONFIG_PROC_FS */
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/piix.h b/drivers/ide/pci/piix.h
--- a/drivers/ide/pci/piix.h	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/piix.h	2004-10-23 23:29:01 +02:00
@@ -5,10 +5,6 @@
 #include <linux/pci.h>
 #include <linux/ide.h>
 
-#define PIIX_DEBUG_DRIVE_INFO		0
-
-#define DISPLAY_PIIX_TIMINGS
-
 static void init_setup_piix(struct pci_dev *, ide_pci_device_t *);
 static unsigned int __devinit init_chipset_piix(struct pci_dev *,
const char *);
 static void init_hwif_piix(ide_hwif_t *);
diff -Nru a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
--- a/drivers/ide/pci/sc1200.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/sc1200.c	2004-10-23 23:29:01 +02:00
@@ -67,55 +67,6 @@
 	return pci_clock;
 }
 
-#define DISPLAY_SC1200_TIMINGS
-
-#if defined(DISPLAY_SC1200_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static int sc1200_get_info(char *, char **, off_t, int);
-extern int (*sc1200_display_info)(char *, char **, off_t, int); /*
ide-proc.c */
-extern char *ide_media_verbose(ide_drive_t *);
-static u8 sc1200_proc = 0;
-
-static struct pci_dev *bmide_dev;
-
-static int sc1200_get_info (char *buffer, char **addr, off_t offset, int count)
-{
-	char *p = buffer;
-	unsigned long bibma = pci_resource_start(bmide_dev, 4);
-	int len;
-	u8  c0 = 0, c1 = 0;
-
-	/*
-	 * at that point bibma+0x2 et bibma+0xa are byte registers
-	 * to investigate:
-	 */
-
-	c0 = inb_p(bibma + 0x02);
-	c1 = inb_p(bibma + 0x0a);
-
-	p += sprintf(p, "\n                               National SCx200
Chipset.\n");
-	p += sprintf(p, "--------------- Primary Channel ----------------
Secondary Channel -------------\n");
-	p += sprintf(p, "                %sabled                         %sabled\n",
-			(c0&0x80) ? "dis" : " en",
-			(c1&0x80) ? "dis" : " en");
-	p += sprintf(p, "--------------- drive0 --------- drive1 --------
drive0 ---------- drive1 ------\n");
-	p += sprintf(p, "DMA enabled:    %s              %s             %s  
            %s\n",
-			(c0&0x20) ? "yes" : "no ", (c0&0x40) ? "yes" : "no ",
-			(c1&0x20) ? "yes" : "no ", (c1&0x40) ? "yes" : "no " );
-
-	p += sprintf(p, "UDMA\n");
-	p += sprintf(p, "DMA\n");
-	p += sprintf(p, "PIO\n");
-
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-#endif /* DISPLAY_SC1200_TIMINGS && CONFIG_PROC_FS */
-
 extern char *ide_xfer_verbose (byte xfer_rate);
 
 /*
@@ -505,21 +456,6 @@
 }
 
 /*
- * Initialize the sc1200 bridge for reliable IDE DMA operation.
- */
-static unsigned int __init init_chipset_sc1200 (struct pci_dev *dev,
const char *name)
-{
-#if defined(DISPLAY_SC1200_TIMINGS) && defined(CONFIG_PROC_FS)
-	if (!bmide_dev) {
-		sc1200_proc = 1;
-		bmide_dev = dev;
-		ide_pci_create_host_proc("sc1200", sc1200_get_info);
-	}
-#endif /* DISPLAY_SC1200_TIMINGS && CONFIG_PROC_FS */
-	return 0;
-}
-
-/*
  * This gets invoked by the IDE driver once for each channel,
  * and performs channel-specific pre-initialization before drive probing.
  */
@@ -545,7 +481,6 @@
 
 static ide_pci_device_t sc1200_chipset __devinitdata = {
 	.name		= "SC1200",
-	.init_chipset	= init_chipset_sc1200,
 	.init_hwif	= init_hwif_sc1200,
 	.channels	= 2,
 	.autodma	= AUTODMA,
diff -Nru a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
--- a/drivers/ide/pci/serverworks.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/serverworks.c	2004-10-23 23:29:01 +02:00
@@ -44,164 +44,6 @@
 static u8 svwks_revision = 0;
 static struct pci_dev *isa_dev;
 
-#if defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 svwks_proc = 0;
-#define SVWKS_MAX_DEVS		2
-static struct pci_dev *svwks_devs[SVWKS_MAX_DEVS];
-static int n_svwks_devs;
-
-static int svwks_get_info (char *buffer, char **addr, off_t offset, int count)
-{
-	char *p = buffer;
-	int i, len;
-
-	p += sprintf(p, "\n                             "
-			"ServerWorks OSB4/CSB5/CSB6\n");
-
-	for (i = 0; i < n_svwks_devs; i++) {
-		struct pci_dev *dev = svwks_devs[i];
-		unsigned long bibma = pci_resource_start(dev, 4);
-		u32 reg40, reg44;
-		u16 reg48, reg56;
-		u8  reg54, c0=0, c1=0;
-
-		pci_read_config_dword(dev, 0x40, &reg40);
-		pci_read_config_dword(dev, 0x44, &reg44);
-		pci_read_config_word(dev, 0x48, &reg48);
-		pci_read_config_byte(dev, 0x54, &reg54);
-		pci_read_config_word(dev, 0x56, &reg56);
-
-		/*
-		 * at that point bibma+0x2 et bibma+0xa are byte registers
-		 * to investigate:
-		 */
-		c0 = inb_p(bibma + 0x02);
-		c1 = inb_p(bibma + 0x0a);
-
-		p += sprintf(p, "\n                            ServerWorks ");
-		switch(dev->device) {
-			case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2:
-			case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE:
-				p += sprintf(p, "CSB6 ");
-				break;
-			case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
-				p += sprintf(p, "CSB5 ");
-				break;
-			case PCI_DEVICE_ID_SERVERWORKS_OSB4IDE:
-				p += sprintf(p, "OSB4 ");
-				break;
-			default:
-				p += sprintf(p, "%04x ", dev->device);
-				break;
-		}
-		p += sprintf(p, "Chipset (rev %02x)\n", svwks_revision);
-
-		p += sprintf(p, "------------------------------- "
-				"General Status "
-				"---------------------------------\n");
-		p += sprintf(p, "--------------- Primary Channel "
-				"---------------- Secondary Channel "
-				"-------------\n");
-		p += sprintf(p, "                %sabled"
-				"                         %sabled\n",
-				(c0&0x80) ? "dis" : " en",
-				(c1&0x80) ? "dis" : " en");
-		p += sprintf(p, "--------------- drive0 --------- drive1 "
-				"-------- drive0 ---------- drive1 ------\n");
-		p += sprintf(p, "DMA enabled:    %s              %s"
-				"             %s               %s\n",
-			(c0&0x20) ? "yes" : "no ",
-			(c0&0x40) ? "yes" : "no ",
-			(c1&0x20) ? "yes" : "no ",
-			(c1&0x40) ? "yes" : "no " );
-		p += sprintf(p, "UDMA enabled:   %s              %s"
-				"             %s               %s\n",
-			(reg54 & 0x01) ? "yes" : "no ",
-			(reg54 & 0x02) ? "yes" : "no ",
-			(reg54 & 0x04) ? "yes" : "no ",
-			(reg54 & 0x08) ? "yes" : "no " );
-		p += sprintf(p, "UDMA enabled:   %s                %s"
-				"               %s                 %s\n",
-			((reg56&0x0005)==0x0005)?"5":
-				((reg56&0x0004)==0x0004)?"4":
-				((reg56&0x0003)==0x0003)?"3":
-				((reg56&0x0002)==0x0002)?"2":
-				((reg56&0x0001)==0x0001)?"1":
-				((reg56&0x000F))?"?":"0",
-			((reg56&0x0050)==0x0050)?"5":
-				((reg56&0x0040)==0x0040)?"4":
-				((reg56&0x0030)==0x0030)?"3":
-				((reg56&0x0020)==0x0020)?"2":
-				((reg56&0x0010)==0x0010)?"1":
-				((reg56&0x00F0))?"?":"0",
-			((reg56&0x0500)==0x0500)?"5":
-				((reg56&0x0400)==0x0400)?"4":
-				((reg56&0x0300)==0x0300)?"3":
-				((reg56&0x0200)==0x0200)?"2":
-				((reg56&0x0100)==0x0100)?"1":
-				((reg56&0x0F00))?"?":"0",
-			((reg56&0x5000)==0x5000)?"5":
-				((reg56&0x4000)==0x4000)?"4":
-				((reg56&0x3000)==0x3000)?"3":
-				((reg56&0x2000)==0x2000)?"2":
-				((reg56&0x1000)==0x1000)?"1":
-				((reg56&0xF000))?"?":"0");
-		p += sprintf(p, "DMA enabled:    %s                %s"
-				"               %s                 %s\n",
-			((reg44&0x00002000)==0x00002000)?"2":
-				((reg44&0x00002100)==0x00002100)?"1":
-				((reg44&0x00007700)==0x00007700)?"0":
-				((reg44&0x0000FF00)==0x0000FF00)?"X":"?",
-			((reg44&0x00000020)==0x00000020)?"2":
-				((reg44&0x00000021)==0x00000021)?"1":
-				((reg44&0x00000077)==0x00000077)?"0":
-				((reg44&0x000000FF)==0x000000FF)?"X":"?",
-			((reg44&0x20000000)==0x20000000)?"2":
-				((reg44&0x21000000)==0x21000000)?"1":
-				((reg44&0x77000000)==0x77000000)?"0":
-				((reg44&0xFF000000)==0xFF000000)?"X":"?",
-			((reg44&0x00200000)==0x00200000)?"2":
-				((reg44&0x00210000)==0x00210000)?"1":
-				((reg44&0x00770000)==0x00770000)?"0":
-				((reg44&0x00FF0000)==0x00FF0000)?"X":"?");
-
-		p += sprintf(p, "PIO  enabled:   %s                %s"
-				"               %s                 %s\n",
-			((reg40&0x00002000)==0x00002000)?"4":
-				((reg40&0x00002200)==0x00002200)?"3":
-				((reg40&0x00003400)==0x00003400)?"2":
-				((reg40&0x00004700)==0x00004700)?"1":
-				((reg40&0x00005D00)==0x00005D00)?"0":"?",
-			((reg40&0x00000020)==0x00000020)?"4":
-				((reg40&0x00000022)==0x00000022)?"3":
-				((reg40&0x00000034)==0x00000034)?"2":
-				((reg40&0x00000047)==0x00000047)?"1":
-				((reg40&0x0000005D)==0x0000005D)?"0":"?",
-			((reg40&0x20000000)==0x20000000)?"4":
-				((reg40&0x22000000)==0x22000000)?"3":
-				((reg40&0x34000000)==0x34000000)?"2":
-				((reg40&0x47000000)==0x47000000)?"1":
-				((reg40&0x5D000000)==0x5D000000)?"0":"?",
-			((reg40&0x00200000)==0x00200000)?"4":
-				((reg40&0x00220000)==0x00220000)?"3":
-				((reg40&0x00340000)==0x00340000)?"2":
-				((reg40&0x00470000)==0x00470000)?"1":
-				((reg40&0x005D0000)==0x005D0000)?"0":"?");
-
-	}
-	p += sprintf(p, "\n");
-
-	/* p - buffer must be less than 4k! */
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-#endif  /* defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS) */
-
 static int check_in_drive_lists (ide_drive_t *drive, const char **list)
 {
 	while (*list)
@@ -616,16 +458,6 @@
 			btr |= (svwks_revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2;
 		pci_write_config_byte(dev, 0x5A, btr);
 	}
-
-
-#if defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS)
-	svwks_devs[n_svwks_devs++] = dev;
-
-	if (!svwks_proc) {
-		svwks_proc = 1;
-		ide_pci_create_host_proc("svwks", svwks_get_info);
-	}
-#endif /* DISPLAY_SVWKS_TIMINGS && CONFIG_PROC_FS */
 
 	return (dev->irq) ? dev->irq : 0;
 }
diff -Nru a/drivers/ide/pci/serverworks.h b/drivers/ide/pci/serverworks.h
--- a/drivers/ide/pci/serverworks.h	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/serverworks.h	2004-10-23 23:29:01 +02:00
@@ -21,8 +21,6 @@
 	NULL
 };
 
-#define DISPLAY_SVWKS_TIMINGS	1
-
 static void init_setup_svwks(struct pci_dev *, ide_pci_device_t *);
 static void init_setup_csb6(struct pci_dev *, ide_pci_device_t *);
 static unsigned int init_chipset_svwks(struct pci_dev *, const char *);
diff -Nru a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
--- a/drivers/ide/pci/slc90e66.c	2004-10-23 23:29:01 +02:00
+++ b/drivers/ide/pci/slc90e66.c	2004-10-23 23:29:01 +02:00
@@ -21,103 +21,6 @@
 
 #include <asm/io.h>
 
-#define DISPLAY_SLC90E66_TIMINGS
-
-#if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static u8 slc90e66_proc = 0;
-static struct pci_dev *bmide_dev;
-
-static int slc90e66_get_info (char *buffer, char **addr, off_t
offset, int count)
-{
-	char *p = buffer;
-	int len;
-	unsigned long bibma = pci_resource_start(bmide_dev, 4);
-	u16 reg40 = 0, psitre = 0, reg42 = 0, ssitre = 0;
-	u8  c0 = 0, c1 = 0;
-	u8  reg44 = 0, reg47 = 0, reg48 = 0, reg4a = 0, reg4b = 0;
-
-	pci_read_config_word(bmide_dev, 0x40, &reg40);
-	pci_read_config_word(bmide_dev, 0x42, &reg42);
-	pci_read_config_byte(bmide_dev, 0x44, &reg44);
-	pci_read_config_byte(bmide_dev, 0x47, &reg47);
-	pci_read_config_byte(bmide_dev, 0x48, &reg48);
-	pci_read_config_byte(bmide_dev, 0x4a, &reg4a);
-	pci_read_config_byte(bmide_dev, 0x4b, &reg4b);
-
-	psitre = (reg40 & 0x4000) ? 1 : 0;
-	ssitre = (reg42 & 0x4000) ? 1 : 0;
-
-        /*
-         * at that point bibma+0x2 et bibma+0xa are byte registers
-         * to investigate:
-         */
-	c0 = inb_p(bibma + 0x02);
-	c1 = inb_p(bibma + 0x0a);
-
-	p += sprintf(p, "                                SLC90E66 Chipset.\n");
-	p += sprintf(p, "--------------- Primary Channel "
-			"---------------- Secondary Channel "
-			"-------------\n");
-	p += sprintf(p, "                %sabled "
-			"                        %sabled\n",
-			(c0&0x80) ? "dis" : " en",
-			(c1&0x80) ? "dis" : " en");
-	p += sprintf(p, "--------------- drive0 --------- drive1 "
-			"-------- drive0 ---------- drive1 ------\n");
-	p += sprintf(p, "DMA enabled:    %s              %s "
-			"            %s               %s\n",
-			(c0&0x20) ? "yes" : "no ",
-			(c0&0x40) ? "yes" : "no ",
-			(c1&0x20) ? "yes" : "no ",
-			(c1&0x40) ? "yes" : "no " );
-	p += sprintf(p, "UDMA enabled:   %s              %s "
-			"            %s               %s\n",
-			(reg48&0x01) ? "yes" : "no ",
-			(reg48&0x02) ? "yes" : "no ",
-			(reg48&0x04) ? "yes" : "no ",
-			(reg48&0x08) ? "yes" : "no " );
-	p += sprintf(p, "UDMA enabled:   %s                %s "
-			"              %s                 %s\n",
-			((reg4a&0x04)==0x04) ? "4" :
-			((reg4a&0x03)==0x03) ? "3" :
-			(reg4a&0x02) ? "2" :
-			(reg4a&0x01) ? "1" :
-			(reg4a&0x00) ? "0" : "X",
-			((reg4a&0x40)==0x40) ? "4" :
-			((reg4a&0x30)==0x30) ? "3" :
-			(reg4a&0x20) ? "2" :
-			(reg4a&0x10) ? "1" :
-			(reg4a&0x00) ? "0" : "X",
-			((reg4b&0x04)==0x04) ? "4" :
-			((reg4b&0x03)==0x03) ? "3" :
-			(reg4b&0x02) ? "2" :
-			(reg4b&0x01) ? "1" :
-			(reg4b&0x00) ? "0" : "X",
-			((reg4b&0x40)==0x40) ? "4" :
-			((reg4b&0x30)==0x30) ? "3" :
-			(reg4b&0x20) ? "2" :
-			(reg4b&0x10) ? "1" :
-			(reg4b&0x00) ? "0" : "X");
-
-	p += sprintf(p, "UDMA\n");
-	p += sprintf(p, "DMA\n");
-	p += sprintf(p, "PIO\n");
-
-/*
- *	FIXME.... Add configuration junk data....blah blah......
- */
-
-	/* p - buffer must be less than 4k! */
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-#endif  /* defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS) */
-
 static u8 slc90e66_ratemask (ide_drive_t *drive)
 {
 	u8 mode	= 2;
@@ -236,6 +139,7 @@
 	if (speed >= XFER_UDMA_0) {
 		if (!(reg48 & u_flag))
 			pci_write_config_word(dev, 0x48, reg48|u_flag);
+		/* FIXME: (reg4a & a_speed) ? */
 		if ((reg4a & u_speed) != u_speed) {
 			pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
 			pci_read_config_word(dev, 0x4a, &reg4a);
@@ -313,18 +217,6 @@
 }
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
-static unsigned int __init init_chipset_slc90e66 (struct pci_dev
*dev, const char *name)
-{
-#if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
-	if (!slc90e66_proc) {
-		slc90e66_proc = 1;
-		bmide_dev = dev;
-		ide_pci_create_host_proc("slc90e66", slc90e66_get_info);
-	}
-#endif /* DISPLAY_SLC90E66_TIMINGS && CONFIG_PROC_FS */
-	return 0;
-}
-
 static void __init init_hwif_slc90e66 (ide_hwif_t *hwif)
 {
 	u8 reg47 = 0;
@@ -366,7 +258,6 @@
 
 static ide_pci_device_t slc90e66_chipset __devinitdata = {
 	.name		= "SLC90E66",
-	.init_chipset	= init_chipset_slc90e66,
 	.init_hwif	= init_hwif_slc90e66,
 	.channels	= 2,
 	.autodma	= AUTODMA,

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-22 18:07 ` Russell King
@ 2004-10-22 18:17   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-22 18:17 UTC (permalink / raw)
  To: torvalds, linux-ide, linux-kernel

On Fri, 22 Oct 2004 19:07:15 +0100, Russell King
<rmk+lkml@arm.linux.org.uk> wrote:
> On Fri, Oct 22, 2004 at 07:38:44PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > @@ -498,14 +483,6 @@
> >                       ICS_ARCIN_V6_INTRSTAT_1)) & 1;
> >  }
> >
> > -static int icside_dma_verbose(ide_drive_t *drive)
> > -{
> > -     printk(", %s (peak %dMB/s)",
> > -             ide_xfer_verbose(drive->current_speed),
> > -             2000 / drive->drive_data);
> > -     return 1;
> > -}
> > -
> >  static int icside_dma_timeout(ide_drive_t *drive)
> >  {
> >       printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
> > @@ -554,7 +531,6 @@
> >       hwif->dma_start         = icside_dma_start;
> >       hwif->ide_dma_end       = icside_dma_end;
> >       hwif->ide_dma_test_irq  = icside_dma_test_irq;
> > -     hwif->ide_dma_verbose   = icside_dma_verbose;
> >       hwif->ide_dma_timeout   = icside_dma_timeout;
> >       hwif->ide_dma_lostirq   = icside_dma_lostirq;
> 
> Why are you denying me the ability to report detailed drive transfer
> speed information?  Would you prefer me to printk a separate line
> and further clutter up the message log instead?

>From the changelog:
> * icside.c version repeated info given by ->ide_dma_check()

If DMA is going to be used:
* ->ide_dma_check is always called
* icside_dma_check() always calls icside_set_speed()
* icside_set_speed() always does

	printk("%s: %s selected (peak %dMB/s)\n", drive->name,
		ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data);

so what am I missing?

Bartlomiej

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [BK PATCHES] ide-2.6 update
  2004-10-22 17:38 Bartlomiej Zolnierkiewicz
@ 2004-10-22 18:07 ` Russell King
  2004-10-22 18:17   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 53+ messages in thread
From: Russell King @ 2004-10-22 18:07 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: torvalds, linux-ide, linux-kernel

On Fri, Oct 22, 2004 at 07:38:44PM +0200, Bartlomiej Zolnierkiewicz wrote:
> @@ -498,14 +483,6 @@
>  			ICS_ARCIN_V6_INTRSTAT_1)) & 1;
>  }
>  
> -static int icside_dma_verbose(ide_drive_t *drive)
> -{
> -	printk(", %s (peak %dMB/s)",
> -		ide_xfer_verbose(drive->current_speed),
> -		2000 / drive->drive_data);
> -	return 1;
> -}
> -
>  static int icside_dma_timeout(ide_drive_t *drive)
>  {
>  	printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
> @@ -554,7 +531,6 @@
>  	hwif->dma_start		= icside_dma_start;
>  	hwif->ide_dma_end	= icside_dma_end;
>  	hwif->ide_dma_test_irq	= icside_dma_test_irq;
> -	hwif->ide_dma_verbose	= icside_dma_verbose;
>  	hwif->ide_dma_timeout	= icside_dma_timeout;
>  	hwif->ide_dma_lostirq	= icside_dma_lostirq;

Why are you denying me the ability to report detailed drive transfer
speed information?  Would you prefer me to printk a separate line
and further clutter up the message log instead?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-10-22 17:38 Bartlomiej Zolnierkiewicz
  2004-10-22 18:07 ` Russell King
  0 siblings, 1 reply; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-22 17:38 UTC (permalink / raw)
  To: torvalds; +Cc: linux-ide, linux-kernel

More syncing with -mm.

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 arch/cris/arch-v10/drivers/ide.c |   10 -
 drivers/ide/arm/icside.c         |   38 +----
 drivers/ide/ide-cd.c             |    5 
 drivers/ide/ide-disk.c           |    2 
 drivers/ide/ide-dma.c            |   87 ++-----------
 drivers/ide/ide-io.c             |   12 +
 drivers/ide/ide-proc.c           |  257 ---------------------------------------
 drivers/ide/ide.c                |    1 
 drivers/ide/pci/sgiioc4.c        |   17 --
 drivers/ide/pci/siimage.c        |    7 -
 drivers/ide/ppc/pmac.c           |   58 --------
 drivers/scsi/ide-scsi.c          |  141 +++++++--------------
 include/linux/ide.h              |    6 
 13 files changed, 95 insertions(+), 546 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/10/22 1.2055)
   [ide] kill /proc/ide/ide?/config
   
   * writes to PCI config space are non-functional since 2.4.21
   * reads of full PCI config space are allowed for normal users
   * I'm not aware of any applications using this interface
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/22 1.2054)
   [ide] kill ide_hwif_t->ide_dma_verbose
   
   * make __ide_dma_verbose() void and drop "__" prefix
   * ide_dma_verbose() is always available now
   * use it instead of ide_hwif_t->ide_dma_verbose
   * sgiioc4.c version reported wrong mode
   * icside.c version repeated info given by ->ide_dma_check()
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/22 1.2053)
   [ide] ide-scsi: simplify+speedup DMA support
   
   * add hwif->sg_mapped flag
   * add idescsi_map_sg() converting scsi_cmd->sg into
     hwif->sg_table (this removes need for rq->bio)
   * remove code (de)allocating rq->bio
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/22 1.2052)
   [ide] kill ide_raw_build_sglist()
   
   ide_build_sglist() can be now used for REQ_DRIVE_TASKFILE requests.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/22 1.2051)
   [ide] use ide_map_sg()
   
   * make Etrax ide.c, icside.c and ide-dma.c use ide_map_sg()
   * use one sg for REQ_DRIVE_TASKFILE requests in ide-dma.c
     (no reason for 128 sectors per sg limit)
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/22 1.2050)
   [ide] pmac: kill pmac_ide_[raw_]build_sglist()
   
   Just use ide_dma_[raw_]build_sglist() from ide-dma.c.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/arch/cris/arch-v10/drivers/ide.c b/arch/cris/arch-v10/drivers/ide.c
--- a/arch/cris/arch-v10/drivers/ide.c	2004-10-22 19:29:05 +02:00
+++ b/arch/cris/arch-v10/drivers/ide.c	2004-10-22 19:29:05 +02:00
@@ -656,15 +656,9 @@
 
 	ata_tot_size = 0;
 
-	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) {
-		sg_init_one(&sg[0], rq->buffer, rq->nr_sectors * SECTOR_SIZE);
-		hwif->sg_nents = i = 1;
-	}
-	else
-	{
-		hwif->sg_nents = i = blk_rq_map_sg(drive->queue, rq, hwif->sg_table);
-	}
+	ide_map_sg(drive, rq);
 
+	i = hwif->sg_nents;
 
 	while(i) {
 		/*
diff -Nru a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
--- a/drivers/ide/arm/icside.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/arm/icside.c	2004-10-22 19:29:05 +02:00
@@ -212,33 +212,18 @@
 	ide_hwif_t *hwif = drive->hwif;
 	struct icside_state *state = hwif->hwif_data;
 	struct scatterlist *sg = hwif->sg_table;
-	int nents;
 
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
+	ide_map_sg(drive, rq);
 
-		if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
-			hwif->sg_dma_direction = DMA_TO_DEVICE;
-		else
-			hwif->sg_dma_direction = DMA_FROM_DEVICE;
-
-		sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
-		nents = 1;
-	} else {
-		nents = blk_rq_map_sg(drive->queue, rq, sg);
-
-		if (rq_data_dir(rq) == READ)
-			hwif->sg_dma_direction = DMA_FROM_DEVICE;
-		else
-			hwif->sg_dma_direction = DMA_TO_DEVICE;
-	}
-
-	nents = dma_map_sg(state->dev, sg, nents, hwif->sg_dma_direction);
+	if (rq_data_dir(rq) == READ)
+		hwif->sg_dma_direction = DMA_FROM_DEVICE;
+	else
+		hwif->sg_dma_direction = DMA_TO_DEVICE;
 
-	hwif->sg_nents = nents;
+	hwif->sg_nents = dma_map_sg(state->dev, sg, hwif->sg_nents,
+				    hwif->sg_dma_direction);
 }
 
-
 /*
  * Configure the IOMD to give the appropriate timings for the transfer
  * mode being requested.  We take the advice of the ATA standards, and
@@ -498,14 +483,6 @@
 			ICS_ARCIN_V6_INTRSTAT_1)) & 1;
 }
 
-static int icside_dma_verbose(ide_drive_t *drive)
-{
-	printk(", %s (peak %dMB/s)",
-		ide_xfer_verbose(drive->current_speed),
-		2000 / drive->drive_data);
-	return 1;
-}
-
 static int icside_dma_timeout(ide_drive_t *drive)
 {
 	printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
@@ -554,7 +531,6 @@
 	hwif->dma_start		= icside_dma_start;
 	hwif->ide_dma_end	= icside_dma_end;
 	hwif->ide_dma_test_irq	= icside_dma_test_irq;
-	hwif->ide_dma_verbose	= icside_dma_verbose;
 	hwif->ide_dma_timeout	= icside_dma_timeout;
 	hwif->ide_dma_lostirq	= icside_dma_lostirq;
 
diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/ide-cd.c	2004-10-22 19:29:05 +02:00
@@ -3039,10 +3039,9 @@
 
 	printk(", %dkB Cache", be16_to_cpu(cap.buffer_size));
 
-#ifdef CONFIG_BLK_DEV_IDEDMA
 	if (drive->using_dma)
-		(void) HWIF(drive)->ide_dma_verbose(drive);
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+		ide_dma_verbose(drive);
+
 	printk("\n");
 
 	return nslots;
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/ide-disk.c	2004-10-22 19:29:05 +02:00
@@ -1244,7 +1244,7 @@
 	printk(", CHS=%d/%d/%d", 
 	       drive->bios_cyl, drive->bios_head, drive->bios_sect);
 	if (drive->using_dma)
-		(void) HWIF(drive)->ide_dma_verbose(drive);
+		ide_dma_verbose(drive);
 	printk("\n");
 
 	drive->mult_count = 0;
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/ide-dma.c	2004-10-22 19:29:05 +02:00
@@ -207,67 +207,23 @@
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	struct scatterlist *sg = hwif->sg_table;
-	int nents;
 
-	nents = blk_rq_map_sg(drive->queue, rq, hwif->sg_table);
-		
+	if ((rq->flags & REQ_DRIVE_TASKFILE) && rq->nr_sectors > 256)
+		BUG();
+
+	ide_map_sg(drive, rq);
+
 	if (rq_data_dir(rq) == READ)
 		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
 	else
 		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
 
-	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
+	return pci_map_sg(hwif->pci_dev, sg, hwif->sg_nents, hwif->sg_dma_direction);
 }
 
 EXPORT_SYMBOL_GPL(ide_build_sglist);
 
 /**
- *	ide_raw_build_sglist	-	map IDE scatter gather for DMA
- *	@drive: the drive to build the DMA table for
- *	@rq: the request holding the sg list
- *
- *	Perform the PCI mapping magic necessary to access the source or
- *	target buffers of a taskfile request via PCI DMA. The lower layers 
- *	of the  kernel provide the necessary cache management so that we can
- *	operate in a portable fashion
- */
-
-int ide_raw_build_sglist(ide_drive_t *drive, struct request *rq)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	struct scatterlist *sg = hwif->sg_table;
-	int nents = 0;
-	ide_task_t *args = rq->special;
-	u8 *virt_addr = rq->buffer;
-	int sector_count = rq->nr_sectors;
-
-	if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
-		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
-	else
-		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
-
-#if 1
-	if (sector_count > 256)
-		BUG();
-
-	if (sector_count > 128) {
-#else
-	while (sector_count > 128) {
-#endif
-		sg_init_one(&sg[nents], virt_addr, 128 * SECTOR_SIZE);
-		nents++;
-		virt_addr = virt_addr + (128 * SECTOR_SIZE);
-		sector_count -= 128;
-	}
-	sg_init_one(&sg[nents], virt_addr, sector_count * SECTOR_SIZE);
-	nents++;
-
-	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
-}
-
-EXPORT_SYMBOL_GPL(ide_raw_build_sglist);
-
-/**
  *	ide_build_dmatable	-	build IDE DMA table
  *
  *	ide_build_dmatable() prepares a dma request. We map the command
@@ -288,10 +244,7 @@
 	int i;
 	struct scatterlist *sg;
 
-	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE)
-		hwif->sg_nents = i = ide_raw_build_sglist(drive, rq);
-	else
-		hwif->sg_nents = i = ide_build_sglist(drive, rq);
+	hwif->sg_nents = i = ide_build_sglist(drive, rq);
 
 	if (!i)
 		return 0;
@@ -728,17 +681,14 @@
 
 EXPORT_SYMBOL(__ide_dma_good_drive);
 
-#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
-int __ide_dma_verbose (ide_drive_t *drive)
+void ide_dma_verbose(ide_drive_t *drive)
 {
 	struct hd_driveid *id	= drive->id;
 	ide_hwif_t *hwif	= HWIF(drive);
 
 	if (id->field_valid & 4) {
-		if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) {
-			printk(", BUG DMA OFF");
-			return hwif->ide_dma_off_quietly(drive);
-		}
+		if ((id->dma_ultra >> 8) && (id->dma_mword >> 8))
+			goto bug_dma_off;
 		if (id->dma_ultra & ((id->dma_ultra >> 8) & hwif->ultra_mask)) {
 			if (((id->dma_ultra >> 11) & 0x1F) &&
 			    eighty_ninty_three(drive)) {
@@ -768,19 +718,22 @@
 			printk(", (U)DMA");	/* Can be BIOS-enabled! */
 		}
 	} else if (id->field_valid & 2) {
-		if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) {
-			printk(", BUG DMA OFF");
-			return hwif->ide_dma_off_quietly(drive);
-		}
+		if ((id->dma_mword >> 8) && (id->dma_1word >> 8))
+			goto bug_dma_off;
 		printk(", DMA");
 	} else if (id->field_valid & 1) {
 		printk(", BUG");
 	}
-	return 1;
+	return;
+bug_dma_off:
+	printk(", BUG DMA OFF");
+	hwif->ide_dma_off_quietly(drive);
+	return;
 }
 
-EXPORT_SYMBOL(__ide_dma_verbose);
+EXPORT_SYMBOL(ide_dma_verbose);
 
+#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
 int __ide_dma_lostirq (ide_drive_t *drive)
 {
 	printk("%s: DMA interrupt recovery\n", drive->name);
@@ -955,8 +908,6 @@
 		hwif->ide_dma_end = &__ide_dma_end;
 	if (!hwif->ide_dma_test_irq)
 		hwif->ide_dma_test_irq = &__ide_dma_test_irq;
-	if (!hwif->ide_dma_verbose)
-		hwif->ide_dma_verbose = &__ide_dma_verbose;
 	if (!hwif->ide_dma_timeout)
 		hwif->ide_dma_timeout = &__ide_dma_timeout;
 	if (!hwif->ide_dma_lostirq)
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/ide-io.c	2004-10-22 19:29:05 +02:00
@@ -680,6 +680,9 @@
 	ide_hwif_t *hwif = drive->hwif;
 	struct scatterlist *sg = hwif->sg_table;
 
+	if (hwif->sg_mapped)	/* needed by ide-scsi */
+		return;
+
 	if ((rq->flags & REQ_DRIVE_TASKFILE) == 0) {
 		hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
 	} else {
@@ -1219,12 +1222,15 @@
 	HWGROUP(drive)->rq = NULL;
 
 	rq->errors = 0;
+
+	if (!rq->bio)
+		goto out;
+
 	rq->sector = rq->bio->bi_sector;
 	rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9;
 	rq->hard_cur_sectors = rq->current_nr_sectors;
-	if (rq->bio)
-		rq->buffer = NULL;
-
+	rq->buffer = NULL;
+out:
 	return ret;
 }
 
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/ide-proc.c	2004-10-22 19:29:05 +02:00
@@ -8,37 +8,6 @@
 /*
  * This is the /proc/ide/ filesystem implementation.
  *
- * The major reason this exists is to provide sufficient access
- * to driver and config data, such that user-mode programs can
- * be developed to handle chipset tuning for most PCI interfaces.
- * This should provide better utilities, and less kernel bloat.
- *
- * The entire pci config space for a PCI interface chipset can be
- * retrieved by just reading it.  e.g.    "cat /proc/ide3/config"
- *
- * To modify registers *safely*, do something like:
- *   echo "P40:88" >/proc/ide/ide3/config
- * That expression writes 0x88 to pci config register 0x40
- * on the chip which controls ide3.  Multiple tuples can be issued,
- * and the writes will be completed as an atomic set:
- *   echo "P40:88 P41:35 P42:00 P43:00" >/proc/ide/ide3/config
- *
- * All numbers must be specified using pairs of ascii hex digits.
- * It is important to note that these writes will be performed
- * after waiting for the IDE controller (both interfaces)
- * to be completely idle, to ensure no corruption of I/O in progress.
- *
- * Non-PCI registers can also be written, using "R" in place of "P"
- * in the above examples.  The size of the port transfer is determined
- * by the number of pairs of hex digits given for the data.  If a two
- * digit value is given, the write will be a byte operation; if four
- * digits are used, the write will be performed as a 16-bit operation;
- * and if eight digits are specified, a 32-bit "dword" write will be
- * performed.  Odd numbers of digits are not permitted.
- *
- * If there is an error *anywhere* in the string of registers/data
- * then *none* of the writes will be performed.
- *
  * Drive/Driver settings can be retrieved by reading the drive's
  * "settings" files.  e.g.    "cat /proc/ide0/hda/settings"
  * To write a new value "val" into a specific setting "name", use:
@@ -51,10 +20,6 @@
  * returned data as 256 16-bit words.  The "hdparm" utility will
  * be updated someday soon to use this mechanism.
  *
- * Feel free to develop and distribute fancy GUI configuration
- * utilities for your favorite PCI chipsets.  I'll be working on
- * one for the Promise 20246 someday soon.  -ml
- *
  */
 
 #include <linux/config.h>
@@ -74,227 +39,6 @@
 
 #include <asm/io.h>
 
-static int proc_ide_write_config(struct file *file, const char __user *buffer,
-				 unsigned long count, void *data)
-{
-	ide_hwif_t	*hwif = (ide_hwif_t *)data;
-	ide_hwgroup_t *mygroup = (ide_hwgroup_t *)(hwif->hwgroup);
-	ide_hwgroup_t *mategroup = NULL;
-	unsigned long timeout;
-	unsigned long flags;
-	const char *start = NULL, *msg = NULL;
-	struct entry { u32 val; u16 reg; u8 size; u8 pci; } *prog, *q, *r;
-	int want_pci = 0;
-	char *buf, *s;
-	int err;
-
-	if (hwif->mate && hwif->mate->hwgroup)
-		mategroup = (ide_hwgroup_t *)(hwif->mate->hwgroup);
-
-	if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
-		return -EACCES;
-
-	if (count >= PAGE_SIZE)
-		return -EINVAL;
-
-	s = buf = (char *)__get_free_page(GFP_USER);
-	if (!buf)
-		return -ENOMEM;
-
-	err = -ENOMEM;
-	q = prog = (struct entry *)__get_free_page(GFP_USER);
-	if (!prog)
-		goto out;
-
-	err = -EFAULT;
-	if (copy_from_user(buf, buffer, count))
-		goto out1;
-
-	buf[count] = '\0';
-
-	while (isspace(*s))
-		s++;
-
-	while (*s) {
-		char *p;
-		int digits;
-
-		start = s;
-
-		if ((char *)(q + 1) > (char *)prog + PAGE_SIZE) {
-			msg = "too many entries";
-			goto parse_error;
-		}
-
-		switch (*s++) {
-			case 'R':	q->pci = 0;
-					break;
-			case 'P':	q->pci = 1;
-					want_pci = 1;
-					break;
-			default:	msg = "expected 'R' or 'P'";
-					goto parse_error;
-		}
-
-		q->reg = simple_strtoul(s, &p, 16);
-		digits = p - s;
-		if (!digits || digits > 4 || (q->pci && q->reg > 0xff)) {
-			msg = "bad/missing register number";
-			goto parse_error;
-		}
-		if (*p++ != ':') {
-			msg = "missing ':'";
-			goto parse_error;
-		}
-		q->val = simple_strtoul(p, &s, 16);
-		digits = s - p;
-		if (digits != 2 && digits != 4 && digits != 8) {
-			msg = "bad data, 2/4/8 digits required";
-			goto parse_error;
-		}
-		q->size = digits / 2;
-
-		if (q->pci) {
-#ifdef CONFIG_BLK_DEV_IDEPCI
-			if (q->reg & (q->size - 1)) {
-				msg = "misaligned access";
-				goto parse_error;
-			}
-#else
-			msg = "not a PCI device";
-			goto parse_error;
-#endif	/* CONFIG_BLK_DEV_IDEPCI */
-		}
-
-		q++;
-
-		if (*s && !isspace(*s++)) {
-			msg = "expected whitespace after data";
-			goto parse_error;
-		}
-		while (isspace(*s))
-			s++;
-	}
-
-	/*
-	 * What follows below is fucking insane, even for IDE people.
-	 * For now I've dealt with the obvious problems on the parsing
-	 * side, but IMNSHO we should simply remove the write access
-	 * to /proc/ide/.../config, killing that FPOS completely.
-	 */
-
-	err = -EBUSY;
-	timeout = jiffies + (3 * HZ);
-	spin_lock_irqsave(&ide_lock, flags);
-	while (mygroup->busy ||
-	       (mategroup && mategroup->busy)) {
-		spin_unlock_irqrestore(&ide_lock, flags);
-		if (time_after(jiffies, timeout)) {
-			printk("/proc/ide/%s/config: channel(s) busy, cannot write\n", hwif->name);
-			goto out1;
-		}
-		spin_lock_irqsave(&ide_lock, flags);
-	}
-
-#ifdef CONFIG_BLK_DEV_IDEPCI
-	if (want_pci && (!hwif->pci_dev || hwif->pci_dev->vendor)) {
-		spin_unlock_irqrestore(&ide_lock, flags);
-		printk("proc_ide: PCI registers not accessible for %s\n",
-			hwif->name);
-		err = -EINVAL;
-		goto out1;
-	}
-#endif	/* CONFIG_BLK_DEV_IDEPCI */
-
-	for (r = prog; r < q; r++) {
-		unsigned int reg = r->reg, val = r->val;
-		if (r->pci) {
-#ifdef CONFIG_BLK_DEV_IDEPCI
-			int rc = 0;
-			struct pci_dev *dev = hwif->pci_dev;
-			switch (q->size) {
-				case 1:	msg = "byte";
-					rc = pci_write_config_byte(dev, reg, val);
-					break;
-				case 2:	msg = "word";
-					rc = pci_write_config_word(dev, reg, val);
-					break;
-				case 4:	msg = "dword";
-					rc = pci_write_config_dword(dev, reg, val);
-					break;
-			}
-			if (rc) {
-				spin_unlock_irqrestore(&ide_lock, flags);
-				printk("proc_ide_write_config: error writing %s at bus %02x dev
%02x reg 0x%x value 0x%x\n",
-					msg, dev->bus->number, dev->devfn, reg, val);
-				printk("proc_ide_write_config: error %d\n", rc);
-				err = -EIO;
-				goto out1;
-			}
-#endif	/* CONFIG_BLK_DEV_IDEPCI */
-		} else {	/* not pci */
-			switch (r->size) {
-				case 1:	hwif->OUTB(val, reg);
-					break;
-				case 2:	hwif->OUTW(val, reg);
-					break;
-				case 4:	hwif->OUTL(val, reg);
-					break;
-			}
-		}
-	}
-	spin_unlock_irqrestore(&ide_lock, flags);
-	err = count;
-out1:
-	free_page((unsigned long)prog);
-out:
-	free_page((unsigned long)buf);
-	return err;
-
-parse_error:
-	printk("parse error\n");
-	printk("proc_ide: error: %s: '%s'\n", msg, start);
-	err = -EINVAL;
-	goto out1;
-}
-
-static int proc_ide_read_config
-	(char *page, char **start, off_t off, int count, int *eof, void *data)
-{
-	char		*out = page;
-	int		len;
-
-#ifdef CONFIG_BLK_DEV_IDEPCI
-	ide_hwif_t	*hwif = (ide_hwif_t *)data;
-	struct pci_dev	*dev = hwif->pci_dev;
-	if ((hwif->pci_dev && hwif->pci_dev->vendor) && dev && dev->bus) {
-		int reg = 0;
-
-		out += sprintf(out, "pci bus %02x device %02x vendor %04x "
-				"device %04x channel %d\n",
-			dev->bus->number, dev->devfn,
-			hwif->pci_dev->vendor, hwif->pci_dev->device,
-			hwif->channel);
-		do {
-			u8 val;
-			int rc = pci_read_config_byte(dev, reg, &val);
-			if (rc) {
-				printk("proc_ide_read_config: error %d reading"
-					" bus %02x dev %02x reg 0x%02x\n",
-					rc, dev->bus->number, dev->devfn, reg);
-				out += sprintf(out, "??%c",
-					(++reg & 0xf) ? ' ' : '\n');
-			} else
-				out += sprintf(out, "%02x%c",
-					val, (++reg & 0xf) ? ' ' : '\n');
-		} while (reg < 0x100);
-	} else
-#endif	/* CONFIG_BLK_DEV_IDEPCI */
-		out += sprintf(out, "(none)\n");
-	len = out - page;
-	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
-}
-
 static int proc_ide_read_imodel
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
@@ -687,7 +431,6 @@
 
 static ide_proc_entry_t hwif_entries[] = {
 	{ "channel",	S_IFREG|S_IRUGO,	proc_ide_read_channel,	NULL },
-	{ "config",	S_IFREG|S_IRUGO|S_IWUSR,proc_ide_read_config,	proc_ide_write_config
},
 	{ "mate",	S_IFREG|S_IRUGO,	proc_ide_read_mate,	NULL },
 	{ "model",	S_IFREG|S_IRUGO,	proc_ide_read_imodel,	NULL },
 	{ NULL,	0, NULL, NULL }
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/ide.c	2004-10-22 19:29:05 +02:00
@@ -694,7 +694,6 @@
 	hwif->ide_dma_test_irq		= tmp_hwif->ide_dma_test_irq;
 	hwif->ide_dma_host_on		= tmp_hwif->ide_dma_host_on;
 	hwif->ide_dma_host_off		= tmp_hwif->ide_dma_host_off;
-	hwif->ide_dma_verbose		= tmp_hwif->ide_dma_verbose;
 	hwif->ide_dma_lostirq		= tmp_hwif->ide_dma_lostirq;
 	hwif->ide_dma_timeout		= tmp_hwif->ide_dma_timeout;
 
diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
--- a/drivers/ide/pci/sgiioc4.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/pci/sgiioc4.c	2004-10-22 19:29:05 +02:00
@@ -332,17 +332,6 @@
 }
 
 static int
-sgiioc4_ide_dma_verbose(ide_drive_t * drive)
-{
-	if (drive->using_dma == 1)
-		printk(", UDMA(16)");
-	else
-		printk(", PIO");
-
-	return 1;
-}
-
-static int
 sgiioc4_ide_dma_lostirq(ide_drive_t * drive)
 {
 	HWIF(drive)->resetproc(drive);
@@ -501,10 +490,7 @@
 	unsigned int count = 0, i = 1;
 	struct scatterlist *sg;
 
-	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE)
-		hwif->sg_nents = i = ide_raw_build_sglist(drive, rq);
-	else
-		hwif->sg_nents = i = ide_build_sglist(drive, rq);
+	hwif->sg_nents = i = ide_build_sglist(drive, rq);
 
 	if (!i)
 		return 0;	/* sglist of length Zero */
@@ -623,7 +609,6 @@
 	hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq;
 	hwif->ide_dma_host_on = &sgiioc4_ide_dma_host_on;
 	hwif->ide_dma_host_off = &sgiioc4_ide_dma_host_off;
-	hwif->ide_dma_verbose = &sgiioc4_ide_dma_verbose;
 	hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq;
 	hwif->ide_dma_timeout = &__ide_dma_timeout;
 	hwif->INB = &sgiioc4_INB;
diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
--- a/drivers/ide/pci/siimage.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/pci/siimage.c	2004-10-22 19:29:05 +02:00
@@ -554,12 +554,6 @@
 	return 0;
 }
 
-static int siimage_mmio_ide_dma_verbose (ide_drive_t *drive)
-{
-	int temp = __ide_dma_verbose(drive);
-	return temp;
-}
-
 /**
  *	siimage_busproc		-	bus isolation ioctl
  *	@drive: drive to isolate/restore
@@ -1077,7 +1071,6 @@
 
 	if (hwif->mmio) {
 		hwif->ide_dma_test_irq = &siimage_mmio_ide_dma_test_irq;
-		hwif->ide_dma_verbose = &siimage_mmio_ide_dma_verbose;
 	} else {
 		hwif->ide_dma_test_irq = & siimage_io_ide_dma_test_irq;
 	}
diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
--- a/drivers/ide/ppc/pmac.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/ide/ppc/pmac.c	2004-10-22 19:29:05 +02:00
@@ -1560,56 +1560,6 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
 
 /*
- * We build & map the sglist for a given request.
- */
-static int __pmac
-pmac_ide_build_sglist(ide_drive_t *drive, struct request *rq)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	struct scatterlist *sg = hwif->sg_table;
-	int nents;
-
-	nents = blk_rq_map_sg(drive->queue, rq, sg);
-		
-	if (rq_data_dir(rq) == READ)
-		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
-	else
-		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
-
-	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
-}
-
-/*
- * Same as above but for a "raw" taskfile request
- */
-static int __pmac
-pmac_ide_raw_build_sglist(ide_drive_t *drive, struct request *rq)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	struct scatterlist *sg = hwif->sg_table;
-	int nents = 0;
-	ide_task_t *args = rq->special;
-	unsigned char *virt_addr = rq->buffer;
-	int sector_count = rq->nr_sectors;
-
-	if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
-		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
-	else
-		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
-
-	if (sector_count > 128) {
-		sg_init_one(&sg[nents], virt_addr, 128 * SECTOR_SIZE);
-		nents++;
-		virt_addr = virt_addr + (128 * SECTOR_SIZE);
-		sector_count -= 128;
-	}
-	sg_init_one(&sg[nents], virt_addr, sector_count * SECTOR_SIZE);
-	nents++;
-
-	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
-}
-
-/*
  * pmac_ide_build_dmatable builds the DBDMA command list
  * for a transfer and sets the DBDMA channel to point to it.
  */
@@ -1632,11 +1582,8 @@
 	while (readl(&dma->status) & RUN)
 		udelay(1);
 
-	/* Build sglist */
-	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE)
-		hwif->sg_nents = i = pmac_ide_raw_build_sglist(drive, rq);
-	else
-		hwif->sg_nents = i = pmac_ide_build_sglist(drive, rq);
+	hwif->sg_nents = i = ide_build_sglist(drive, rq);
+
 	if (!i)
 		return 0;
 
@@ -2078,7 +2025,6 @@
 	hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq;
 	hwif->ide_dma_host_off = &pmac_ide_dma_host_off;
 	hwif->ide_dma_host_on = &pmac_ide_dma_host_on;
-	hwif->ide_dma_verbose = &__ide_dma_verbose;
 	hwif->ide_dma_timeout = &__ide_dma_timeout;
 	hwif->ide_dma_lostirq = &pmac_ide_dma_lostirq;
 
diff -Nru a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
--- a/drivers/scsi/ide-scsi.c	2004-10-22 19:29:05 +02:00
+++ b/drivers/scsi/ide-scsi.c	2004-10-22 19:29:05 +02:00
@@ -45,6 +45,7 @@
 #include <linux/hdreg.h>
 #include <linux/slab.h>
 #include <linux/ide.h>
+#include <linux/scatterlist.h>
 
 #include <asm/io.h>
 #include <asm/bitops.h>
@@ -253,17 +254,6 @@
 		kfree(atapi_buf);
 }
 
-static inline void idescsi_free_bio (struct bio *bio)
-{
-	struct bio *bhp;
-
-	while (bio) {
-		bhp = bio;
-		bio = bio->bi_next;
-		bio_put(bhp);
-	}
-}
-
 static void hexdump(u8 *x, int len)
 {
 	int i;
@@ -421,7 +411,6 @@
 	spin_lock_irqsave(host->host_lock, flags);
 	pc->done(pc->scsi_cmd);
 	spin_unlock_irqrestore(host->host_lock, flags);
-	idescsi_free_bio(rq->bio);
 	kfree(pc);
 	kfree(rq);
 	scsi->pc = NULL;
@@ -585,6 +574,50 @@
 	return ide_started;
 }
 
+static inline int idescsi_set_direction(idescsi_pc_t *pc)
+{
+	switch (pc->c[0]) {
+		case READ_6: case READ_10: case READ_12:
+			clear_bit(PC_WRITING, &pc->flags);
+			return 0;
+		case WRITE_6: case WRITE_10: case WRITE_12:
+			set_bit(PC_WRITING, &pc->flags);
+			return 0;
+		default:
+			return 1;
+	}
+}
+
+static int idescsi_map_sg(ide_drive_t *drive, idescsi_pc_t *pc)
+{
+	ide_hwif_t *hwif = drive->hwif;
+	struct scatterlist *sg, *scsi_sg;
+	int segments;
+
+	if (!pc->request_transfer || pc->request_transfer % 1024)
+		return 1;
+
+	if (idescsi_set_direction(pc))
+		return 1;
+
+	sg = hwif->sg_table;
+	scsi_sg = pc->scsi_cmd->request_buffer;
+	segments = pc->scsi_cmd->use_sg;
+
+	if (segments > hwif->sg_max_nents)
+		return 1;
+
+	if (!segments) {
+		hwif->sg_nents = 1;
+		sg_init_one(sg, pc->scsi_cmd->request_buffer, pc->request_transfer);
+	} else {
+		hwif->sg_nents = segments;
+		memcpy(sg, scsi_sg, sizeof(*sg) * segments);
+	}
+
+	return 0;
+}
+
 /*
  *	Issue a packet command
  */
@@ -594,7 +627,6 @@
 	ide_hwif_t *hwif = drive->hwif;
 	atapi_feature_t feature;
 	atapi_bcount_t bcount;
-	struct request *rq = pc->rq;
 
 	scsi->pc=pc;							/* Set the current packet command */
 	pc->actually_transferred=0;					/* We haven't transferred any data yet */
@@ -602,8 +634,11 @@
 	bcount.all = min(pc->request_transfer, 63 * 1024);		/* Request to
transfer the entire buffer at once */
 
 	feature.all = 0;
-	if (drive->using_dma && rq->bio)
+	if (drive->using_dma && !idescsi_map_sg(drive, pc)) {
+		hwif->sg_mapped = 1;
 		feature.b.dma = !hwif->dma_setup(drive);
+		hwif->sg_mapped = 0;
+	}
 
 	SELECT_DRIVE(drive);
 	if (IDE_CONTROL_REG)
@@ -775,81 +810,6 @@
 	return -EINVAL;
 }
 
-static inline struct bio *idescsi_kmalloc_bio (int count)
-{
-	struct bio *bh, *bhp, *first_bh;
-
-	if ((first_bh = bhp = bh = bio_alloc(GFP_ATOMIC, 1)) == NULL)
-		goto abort;
-	bio_init(bh);
-	bh->bi_vcnt = 1;
-	while (--count) {
-		if ((bh = bio_alloc(GFP_ATOMIC, 1)) == NULL)
-			goto abort;
-		bio_init(bh);
-		bh->bi_vcnt = 1;
-		bhp->bi_next = bh;
-		bhp = bh;
-		bh->bi_next = NULL;
-	}
-	return first_bh;
-abort:
-	idescsi_free_bio (first_bh);
-	return NULL;
-}
-
-static inline int idescsi_set_direction (idescsi_pc_t *pc)
-{
-	switch (pc->c[0]) {
-		case READ_6: case READ_10: case READ_12:
-			clear_bit (PC_WRITING, &pc->flags);
-			return 0;
-		case WRITE_6: case WRITE_10: case WRITE_12:
-			set_bit (PC_WRITING, &pc->flags);
-			return 0;
-		default:
-			return 1;
-	}
-}
-
-static inline struct bio *idescsi_dma_bio(ide_drive_t *drive, idescsi_pc_t *pc)
-{
-	struct bio *bh = NULL, *first_bh = NULL;
-	int segments = pc->scsi_cmd->use_sg;
-	struct scatterlist *sg = pc->scsi_cmd->request_buffer;
-
-	if (!drive->using_dma || !pc->request_transfer || pc->request_transfer % 1024)
-		return NULL;
-	if (idescsi_set_direction(pc))
-		return NULL;
-	if (segments) {
-		if ((first_bh = bh = idescsi_kmalloc_bio (segments)) == NULL)
-			return NULL;
-#if IDESCSI_DEBUG_LOG
-		printk ("ide-scsi: %s: building DMA table, %d segments, %dkB
total\n", drive->name, segments, pc->request_transfer >> 10);
-#endif /* IDESCSI_DEBUG_LOG */
-		while (segments--) {
-			bh->bi_io_vec[0].bv_page = sg->page;
-			bh->bi_io_vec[0].bv_len = sg->length;
-			bh->bi_io_vec[0].bv_offset = sg->offset;
-			bh->bi_size = sg->length;
-			bh = bh->bi_next;
-			sg++;
-		}
-	} else {
-		if ((first_bh = bh = idescsi_kmalloc_bio (1)) == NULL)
-			return NULL;
-#if IDESCSI_DEBUG_LOG
-		printk ("ide-scsi: %s: building DMA table for a single buffer
(%dkB)\n", drive->name, pc->request_transfer >> 10);
-#endif /* IDESCSI_DEBUG_LOG */
-		bh->bi_io_vec[0].bv_page = virt_to_page(pc->scsi_cmd->request_buffer);
-		bh->bi_io_vec[0].bv_offset = offset_in_page(pc->scsi_cmd->request_buffer);
-		bh->bi_io_vec[0].bv_len = pc->request_transfer;
-		bh->bi_size = pc->request_transfer;
-	}
-	return first_bh;
-}
-
 static inline int should_transform(ide_drive_t *drive, struct scsi_cmnd *cmd)
 {
 	idescsi_scsi_t *scsi = drive_to_idescsi(drive);
@@ -921,7 +881,6 @@
 
 	ide_init_drive_cmd (rq);
 	rq->special = (char *) pc;
-	rq->bio = idescsi_dma_bio (drive, pc);
 	rq->flags = REQ_SPECIAL;
 	spin_unlock_irq(host->host_lock);
 	(void) ide_do_drive_cmd (drive, rq, ide_end);
@@ -975,7 +934,6 @@
 		 */
 		printk (KERN_ERR "ide-scsi: cmd aborted!\n");
 
-		idescsi_free_bio(scsi->pc->rq->bio);
 		if (scsi->pc->rq->flags & REQ_SENSE)
 			kfree(scsi->pc->buffer);
 		kfree(scsi->pc->rq);
@@ -1024,7 +982,6 @@
 	/* kill current request */
 	blkdev_dequeue_request(req);
 	end_that_request_last(req);
-	idescsi_free_bio(req->bio);
 	if (req->flags & REQ_SENSE)
 		kfree(scsi->pc->buffer);
 	kfree(scsi->pc);
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2004-10-22 19:29:05 +02:00
+++ b/include/linux/ide.h	2004-10-22 19:29:05 +02:00
@@ -874,7 +874,6 @@
 	int (*ide_dma_test_irq)(ide_drive_t *drive);
 	int (*ide_dma_host_on)(ide_drive_t *drive);
 	int (*ide_dma_host_off)(ide_drive_t *drive);
-	int (*ide_dma_verbose)(ide_drive_t *drive);
 	int (*ide_dma_lostirq)(ide_drive_t *drive);
 	int (*ide_dma_timeout)(ide_drive_t *drive);
 
@@ -938,6 +937,7 @@
 	unsigned	no_lba48_dma : 1; /* 1 = cannot do LBA48 DMA */
 	unsigned	no_dsc     : 1;	/* 0 default, 1 dsc_overlap disabled */
 	unsigned	auto_poll  : 1; /* supports nop auto-poll */
+	unsigned	sg_mapped  : 1;	/* sg_table and sg_nents are ready */
 
 	struct device	gendev;
 	struct semaphore gendev_rel_sem; /* To deal with device release() */
@@ -1492,10 +1492,10 @@
 int __ide_dma_bad_drive(ide_drive_t *);
 int __ide_dma_good_drive(ide_drive_t *);
 int __ide_dma_off(ide_drive_t *);
+void ide_dma_verbose(ide_drive_t *);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
 extern int ide_build_sglist(ide_drive_t *, struct request *);
-extern int ide_raw_build_sglist(ide_drive_t *, struct request *);
 extern int ide_build_dmatable(ide_drive_t *, struct request *);
 extern void ide_destroy_dmatable(ide_drive_t *);
 extern ide_startstop_t ide_dma_intr(ide_drive_t *);
@@ -1511,13 +1511,13 @@
 extern void ide_dma_start(ide_drive_t *);
 extern int __ide_dma_end(ide_drive_t *);
 extern int __ide_dma_test_irq(ide_drive_t *);
-extern int __ide_dma_verbose(ide_drive_t *);
 extern int __ide_dma_lostirq(ide_drive_t *);
 extern int __ide_dma_timeout(ide_drive_t *);
 #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
 
 #else
 static inline int __ide_dma_off(ide_drive_t *drive) { return 0; }
+static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
 #ifndef CONFIG_BLK_DEV_IDEDMA_PCI

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-10-22  0:34 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-22  0:34 UTC (permalink / raw)
  To: torvalds; +Cc: linux-ide, linux-kernel

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 drivers/ide/legacy/pdc4030.c |  679 -------------------------------------------
 drivers/ide/legacy/pdc4030.h |   70 ----
 Documentation/ide.txt        |    4 
 drivers/block/ll_rw_blk.c    |  114 -------
 drivers/ide/Kconfig          |   22 -
 drivers/ide/ide-disk.c       |  168 ----------
 drivers/ide/ide-io.c         |   12 
 drivers/ide/ide-probe.c      |   19 -
 drivers/ide/ide-proc.c       |    1 
 drivers/ide/ide.c            |   18 -
 drivers/ide/legacy/Makefile  |    1 
 drivers/ide/pci/sgiioc4.c    |    1 
 include/linux/blkdev.h       |   36 --
 include/linux/ide.h          |    4 
 14 files changed, 17 insertions(+), 1132 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/10/22 1.2039)
   [ide] kill CONFIG_IDE_TASKFILE_IO
   
   It is not needed any longer:
   * PIO code is unified and converted to use scatterlists
   * taskfile code doesn't support falling back to PIO
   * it is much easier to convert non-taskfile version of
     __ide_do_rw_disk() to something sane than taskfile one
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/22 1.2038)
   [block] remove bio walking
   
   All users of this code were fixed to use scatterlists.
   
   Acked by Jens.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/21 1.2037)
   [ide] remove broken pdc4030 driver
   
   Sigh, I broke it by accident 16 months ago and nobody has noticed
   (I suspect that it was non-functional even earlier).
   
   Additionally, this driver:
   * should be converted to use scatterlists
   * has verbose debugging enabled by default
   * needs hacks all over IDE code
   * is guilty of crimes against ide_hwifs[]
   
   Just remove it for now.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/Documentation/ide.txt b/Documentation/ide.txt
--- a/Documentation/ide.txt	2004-10-22 02:20:30 +02:00
+++ b/Documentation/ide.txt	2004-10-22 02:20:30 +02:00
@@ -304,7 +304,7 @@
 
  "ide=reverse"		: formerly called to pci sub-system, but now local.
 
-The following are valid ONLY on ide0 (except dc4030), which usually corresponds
+The following are valid ONLY on ide0, which usually corresponds
 to the first ATA interface found on the particular host, and the defaults for
 the base,ctl ports must not be altered.
 
@@ -315,7 +315,7 @@
  "ide0=qd65xx"		: probe/support qd65xx interface
  "ide0=ali14xx"		: probe/support ali14xx chipsets (ALI M1439/M1443/M1445)
  "ide0=umc8672"		: probe/support umc8672 chipsets
- "idex=dc4030"		: probe/support Promise DC4030VL interface
+
  "ide=doubler"		: probe/support IDE doublers on Amiga
 
 There may be more options than shown -- use the source, Luke!
diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c	2004-10-22 02:20:30 +02:00
+++ b/drivers/block/ll_rw_blk.c	2004-10-22 02:20:30 +02:00
@@ -2360,9 +2360,7 @@
 				break;
 
 			bio->bi_next = req->bio;
-			req->cbio = req->bio = bio;
-			req->nr_cbio_segments = bio_segments(bio);
-			req->nr_cbio_sectors = bio_sectors(bio);
+			req->bio = bio;
 
 			/*
 			 * may not be valid. if the low level driver said
@@ -2434,11 +2432,9 @@
 	req->current_nr_sectors = req->hard_cur_sectors = cur_nr_sectors;
 	req->nr_phys_segments = bio_phys_segments(q, bio);
 	req->nr_hw_segments = bio_hw_segments(q, bio);
-	req->nr_cbio_segments = bio_segments(bio);
-	req->nr_cbio_sectors = bio_sectors(bio);
 	req->buffer = bio_data(bio);	/* see ->buffer comment above */
 	req->waiting = NULL;
-	req->cbio = req->bio = req->biotail = bio;
+	req->bio = req->biotail = bio;
 	req->rq_disk = bio->bi_bdev->bd_disk;
 	req->start_time = jiffies;
 
@@ -2685,83 +2681,6 @@
 
 EXPORT_SYMBOL(submit_bio);
 
-/**
- * blk_rq_next_segment
- * @rq:		the request being processed
- *
- * Description:
- *	Points to the next segment in the request if the current segment
- *	is complete. Leaves things unchanged if this segment is not over
- *	or if no more segments are left in this request.
- *
- *	Meant to be used for bio traversal during I/O submission
- *	Does not affect any I/O completions or update completion state
- *	in the request, and does not modify any bio fields.
- *
- *	Decrementing rq->nr_sectors, rq->current_nr_sectors and
- *	rq->nr_cbio_sectors as data is transferred is the caller's
- *	responsibility and should be done before calling this routine.
- **/
-void blk_rq_next_segment(struct request *rq)
-{
-	if (rq->current_nr_sectors > 0)
-		return;
-
-	if (rq->nr_cbio_sectors > 0) {
-		--rq->nr_cbio_segments;
-		rq->current_nr_sectors = blk_rq_vec(rq)->bv_len >> 9;
-	} else {
-		if ((rq->cbio = rq->cbio->bi_next)) {
-			rq->nr_cbio_segments = bio_segments(rq->cbio);
-			rq->nr_cbio_sectors = bio_sectors(rq->cbio);
- 			rq->current_nr_sectors = bio_cur_sectors(rq->cbio);
-		}
- 	}
-
-	/* remember the size of this segment before we start I/O */
-	rq->hard_cur_sectors = rq->current_nr_sectors;
-}
-
-/**
- * process_that_request_first	-	process partial request submission
- * @req:	the request being processed
- * @nr_sectors:	number of sectors I/O has been submitted on
- *
- * Description:
- *	May be used for processing bio's while submitting I/O without
- *	signalling completion. Fails if more data is requested than is
- *	available in the request in which case it doesn't advance any
- *	pointers.
- *
- *	Assumes a request is correctly set up. No sanity checks.
- *
- * Return:
- *	0 - no more data left to submit (not processed)
- *	1 - data available to submit for this request (processed)
- **/
-int process_that_request_first(struct request *req, unsigned int nr_sectors)
-{
-	unsigned int nsect;
-
-	if (req->nr_sectors < nr_sectors)
-		return 0;
-
-	req->nr_sectors -= nr_sectors;
-	req->sector += nr_sectors;
-	while (nr_sectors) {
-		nsect = min_t(unsigned, req->current_nr_sectors, nr_sectors);
-		req->current_nr_sectors -= nsect;
-		nr_sectors -= nsect;
-		if (req->cbio) {
-			req->nr_cbio_sectors -= nsect;
-			blk_rq_next_segment(req);
-		}
-	}
-	return 1;
-}
-
-EXPORT_SYMBOL(process_that_request_first);
-
 void blk_recalc_rq_segments(struct request *rq)
 {
 	struct bio *bio, *prevbio = NULL;
@@ -2797,8 +2716,7 @@
 		rq->hard_nr_sectors -= nsect;
 
 		/*
-		 * Move the I/O submission pointers ahead if required,
-		 * i.e. for drivers not aware of rq->cbio.
+		 * Move the I/O submission pointers ahead if required.
 		 */
 		if ((rq->nr_sectors >= rq->hard_nr_sectors) &&
 		    (rq->sector <= rq->hard_sector)) {
@@ -2806,11 +2724,7 @@
 			rq->nr_sectors = rq->hard_nr_sectors;
 			rq->hard_cur_sectors = bio_cur_sectors(rq->bio);
 			rq->current_nr_sectors = rq->hard_cur_sectors;
-			rq->nr_cbio_segments = bio_segments(rq->bio);
-			rq->nr_cbio_sectors = bio_sectors(rq->bio);
 			rq->buffer = bio_data(rq->bio);
-
-			rq->cbio = rq->bio;
 		}
 
 		/*
@@ -3022,32 +2936,12 @@
 	rq->current_nr_sectors = bio_cur_sectors(bio);
 	rq->hard_cur_sectors = rq->current_nr_sectors;
 	rq->hard_nr_sectors = rq->nr_sectors = bio_sectors(bio);
-	rq->nr_cbio_segments = bio_segments(bio);
-	rq->nr_cbio_sectors = bio_sectors(bio);
 	rq->buffer = bio_data(bio);
 
-	rq->cbio = rq->bio = rq->biotail = bio;
+	rq->bio = rq->biotail = bio;
 }
 
 EXPORT_SYMBOL(blk_rq_bio_prep);
-
-void blk_rq_prep_restart(struct request *rq)
-{
-	struct bio *bio;
-
-	bio = rq->cbio = rq->bio;
-	if (bio) {
-		rq->nr_cbio_segments = bio_segments(bio);
-		rq->nr_cbio_sectors = bio_sectors(bio);
-		rq->hard_cur_sectors = bio_cur_sectors(bio);
-		rq->buffer = bio_data(bio);
-	}
-	rq->sector = rq->hard_sector;
-	rq->nr_sectors = rq->hard_nr_sectors;
-	rq->current_nr_sectors = rq->hard_cur_sectors;
-}
-
-EXPORT_SYMBOL(blk_rq_prep_restart);
 
 int kblockd_schedule_work(struct work_struct *work)
 {
diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig
--- a/drivers/ide/Kconfig	2004-10-22 02:20:30 +02:00
+++ b/drivers/ide/Kconfig	2004-10-22 02:20:30 +02:00
@@ -273,15 +273,6 @@
 
 	  If you are unsure, say N here.
 
-config IDE_TASKFILE_IO
-	bool 'IDE Taskfile IO (EXPERIMENTAL)'
-	depends on EXPERIMENTAL
-	default n
-	---help---
-	  Use new taskfile IO code.
-
-	  It is safe to say Y to this question, in most cases.
-
 comment "IDE chipset support/bugfixes"
 
 config IDE_GENERIC
@@ -1006,19 +997,6 @@
 	  of the Holtek card, and permits faster I/O speeds to be set as well.
 	  See the <file:Documentation/ide.txt> and
 	  <file:drivers/ide/legacy/ht6560b.c> files for more info.
-
-config BLK_DEV_PDC4030
-	tristate "PROMISE DC4030 support (EXPERIMENTAL)"
-	depends on BLK_DEV_IDEDISK && EXPERIMENTAL
-	help
-	  This driver provides support for the secondary IDE interface and
-	  cache of the original Promise IDE chipsets, e.g. DC4030 and DC5030.
-	  It is nothing to do with the later range of Promise UDMA chipsets -
-	  see the PDC_202XX support for these. CD-ROM and TAPE devices are not
-	  supported (and probably never will be since I don't think the cards
-	  support them). This driver is enabled at runtime using the "ide0=dc4030"
-	  or "ide1=dc4030" kernel boot parameter. See the
-	  <file:drivers/ide/legacy/pdc4030.c> file for more info.
 
 config BLK_DEV_QD65XX
 	tristate "QDI QD65xx support"
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2004-10-22 02:20:30 +02:00
+++ b/drivers/ide/ide-disk.c	2004-10-22 02:20:30 +02:00
@@ -71,10 +71,6 @@
 #include <asm/io.h>
 #include <asm/div64.h>
 
-/* FIXME: some day we shouldn't need to look in here! */
-
-#include "legacy/pdc4030.h"
-
 /*
  * lba_capacity_is_ok() performs a sanity check on the claimed "lba_capacity"
  * value for this drive (from its reported identification information).
@@ -120,8 +116,6 @@
 	return 0;	/* lba_capacity value may be bad */
 }
 
-#ifndef CONFIG_IDE_TASKFILE_IO
-
 /*
  * __ide_do_rw_disk() issues READ and WRITE commands to a disk,
  * using LBA if supported, or CHS otherwise, to address sectors.
@@ -150,6 +144,8 @@
 	if (IDE_CONTROL_REG)
 		hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
 
+	/* FIXME: SELECT_MASK(drive, 0) ? */
+
 	if (drive->select.b.lba) {
 		if (drive->addressing == 1) {
 			task_ioreg_t tasklets[10];
@@ -254,6 +250,7 @@
 			command = lba48 ? WIN_WRITE_EXT : WIN_WRITE;
 		}
 
+		/* FIXME: ->OUTBSYNC ? */
 		hwif->OUTB(command, IDE_COMMAND_REG);
 
 		pre_task_out_intr(drive, rq);
@@ -262,169 +259,12 @@
 }
 EXPORT_SYMBOL_GPL(__ide_do_rw_disk);
 
-#else /* CONFIG_IDE_TASKFILE_IO */
-
-static ide_startstop_t chs_rw_disk(ide_drive_t *, struct request *,
unsigned long);
-static ide_startstop_t lba_28_rw_disk(ide_drive_t *, struct request
*, unsigned long);
-static ide_startstop_t lba_48_rw_disk(ide_drive_t *, struct request
*, unsigned long long);
-
-/*
- * __ide_do_rw_disk() issues READ and WRITE commands to a disk,
- * using LBA if supported, or CHS otherwise, to address sectors.
- * It also takes care of issuing special DRIVE_CMDs.
- */
-ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request
*rq, sector_t block)
-{
-	/*
-	 * 268435455  == 137439 MB or 28bit limit
-	 *
-	 * need to add split taskfile operations based on 28bit threshold.
-	 */
-	if (drive->addressing == 1)		/* 48-bit LBA */
-		return lba_48_rw_disk(drive, rq, (unsigned long long) block);
-	if (drive->select.b.lba)		/* 28-bit LBA */
-		return lba_28_rw_disk(drive, rq, (unsigned long) block);
-
-	/* 28-bit CHS : DIE DIE DIE piece of legacy crap!!! */
-	return chs_rw_disk(drive, rq, (unsigned long) block);
-}
-EXPORT_SYMBOL_GPL(__ide_do_rw_disk);
-
-static u8 get_command(ide_drive_t *drive, struct request *rq, ide_task_t *task)
-{
-	unsigned int lba48 = (drive->addressing == 1) ? 1 : 0;
-	unsigned int dma = drive->using_dma;
-
-	if (drive->hwif->no_lba48_dma && lba48 && dma) {
-		if (rq->sector + rq->nr_sectors > 1ULL << 28)
-			dma = 0;
-	}
-
-	if (!dma) {
-		ide_init_sg_cmd(drive, rq);
-		ide_map_sg(drive, rq);
-	}
-
-	if (rq_data_dir(rq) == READ) {
-		task->command_type = IDE_DRIVE_TASK_IN;
-		if (dma)
-			return lba48 ? WIN_READDMA_EXT : WIN_READDMA;
-		task->handler = &task_in_intr;
-		if (drive->mult_count) {
-			task->data_phase = TASKFILE_MULTI_IN;
-			return lba48 ? WIN_MULTREAD_EXT : WIN_MULTREAD;
-		}
-		task->data_phase = TASKFILE_IN;
-		return lba48 ? WIN_READ_EXT : WIN_READ;
-	} else {
-		task->command_type = IDE_DRIVE_TASK_RAW_WRITE;
-		if (dma)
-			return lba48 ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
-		task->prehandler = &pre_task_out_intr;
-		task->handler = &task_out_intr;
-		if (drive->mult_count) {
-			task->data_phase = TASKFILE_MULTI_OUT;
-			return lba48 ? WIN_MULTWRITE_EXT : WIN_MULTWRITE;
-		}
-		task->data_phase = TASKFILE_OUT;
-		return lba48 ? WIN_WRITE_EXT : WIN_WRITE;
-	}
-}
-
-static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct
request *rq, unsigned long block)
-{
-	ide_task_t		args;
-	int			sectors;
-	ata_nsector_t		nsectors;
-	unsigned int track	= (block / drive->sect);
-	unsigned int sect	= (block % drive->sect) + 1;
-	unsigned int head	= (track % drive->head);
-	unsigned int cyl	= (track / drive->head);
-
-	nsectors.all = (u16) rq->nr_sectors;
-
-	pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect);
-
-	memset(&args, 0, sizeof(ide_task_t));
-
-	sectors	= (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors;
-
-	args.tfRegister[IDE_NSECTOR_OFFSET]	= sectors;
-	args.tfRegister[IDE_SECTOR_OFFSET]	= sect;
-	args.tfRegister[IDE_LCYL_OFFSET]	= cyl;
-	args.tfRegister[IDE_HCYL_OFFSET]	= (cyl>>8);
-	args.tfRegister[IDE_SELECT_OFFSET]	= head;
-	args.tfRegister[IDE_SELECT_OFFSET]	|= drive->select.all;
-	args.tfRegister[IDE_COMMAND_OFFSET]	= get_command(drive, rq, &args);
-	args.rq					= (struct request *) rq;
-	rq->special				= (ide_task_t *)&args;
-	drive->hwif->data_phase = args.data_phase;
-	return do_rw_taskfile(drive, &args);
-}
-
-static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct
request *rq, unsigned long block)
-{
-	ide_task_t		args;
-	int			sectors;
-	ata_nsector_t		nsectors;
-
-	nsectors.all = (u16) rq->nr_sectors;
-
-	memset(&args, 0, sizeof(ide_task_t));
-
-	sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors;
-
-	args.tfRegister[IDE_NSECTOR_OFFSET]	= sectors;
-	args.tfRegister[IDE_SECTOR_OFFSET]	= block;
-	args.tfRegister[IDE_LCYL_OFFSET]	= (block>>=8);
-	args.tfRegister[IDE_HCYL_OFFSET]	= (block>>=8);
-	args.tfRegister[IDE_SELECT_OFFSET]	= ((block>>8)&0x0f);
-	args.tfRegister[IDE_SELECT_OFFSET]	|= drive->select.all;
-	args.tfRegister[IDE_COMMAND_OFFSET]	= get_command(drive, rq, &args);
-	args.rq					= (struct request *) rq;
-	rq->special				= (ide_task_t *)&args;
-	drive->hwif->data_phase = args.data_phase;
-	return do_rw_taskfile(drive, &args);
-}
-
 /*
  * 268435455  == 137439 MB or 28bit limit
  * 320173056  == 163929 MB or 48bit addressing
  * 1073741822 == 549756 MB or 48bit addressing fake drive
  */
 
-static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct
request *rq, unsigned long long block)
-{
-	ide_task_t		args;
-	int			sectors;
-	ata_nsector_t		nsectors;
-
-	nsectors.all = (u16) rq->nr_sectors;
-
-	memset(&args, 0, sizeof(ide_task_t));
-
-	sectors = (rq->nr_sectors == 65536) ? 0 : rq->nr_sectors;
-
-	args.tfRegister[IDE_NSECTOR_OFFSET]	= sectors;
-	args.hobRegister[IDE_NSECTOR_OFFSET]	= sectors >> 8;
-	args.tfRegister[IDE_SECTOR_OFFSET]	= block;	/* low lba */
-	args.tfRegister[IDE_LCYL_OFFSET]	= (block>>=8);	/* mid lba */
-	args.tfRegister[IDE_HCYL_OFFSET]	= (block>>=8);	/* hi  lba */
-	args.tfRegister[IDE_SELECT_OFFSET]	= drive->select.all;
-	args.tfRegister[IDE_COMMAND_OFFSET]	= get_command(drive, rq, &args);
-	args.hobRegister[IDE_SECTOR_OFFSET]	= (block>>=8);	/* low lba */
-	args.hobRegister[IDE_LCYL_OFFSET]	= (block>>=8);	/* mid lba */
-	args.hobRegister[IDE_HCYL_OFFSET]	= (block>>=8);	/* hi  lba */
-	args.hobRegister[IDE_SELECT_OFFSET]	= drive->select.all;
-	args.hobRegister[IDE_CONTROL_OFFSET_HOB]= (drive->ctl|0x80);
-	args.rq					= (struct request *) rq;
-	rq->special				= (ide_task_t *)&args;
-	drive->hwif->data_phase = args.data_phase;
-	return do_rw_taskfile(drive, &args);
-}
-
-#endif /* CONFIG_IDE_TASKFILE_IO */
-
 static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct
request *rq, sector_t block)
 {
 	ide_hwif_t *hwif = HWIF(drive);
@@ -862,6 +702,8 @@
 {
 	return drive->capacity64 - drive->sect0;
 }
+
+#define IS_PDC4030_DRIVE	0
 
 static ide_startstop_t idedisk_special (ide_drive_t *drive)
 {
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2004-10-22 02:20:30 +02:00
+++ b/drivers/ide/ide-io.c	2004-10-22 02:20:30 +02:00
@@ -1587,18 +1587,6 @@
 	int where = ELEVATOR_INSERT_BACK, err;
 	int must_wait = (action == ide_wait || action == ide_head_wait);
 
-#ifdef CONFIG_BLK_DEV_PDC4030
-	/*
-	 *	FIXME: there should be a drive or hwif->special
-	 *	handler that points here by default, not hacks
-	 *	in the ide-io.c code
-	 *
-	 *	FIXME2: That code breaks power management if used with
-	 *	this chipset, that really doesn't belong here !
-	 */
-	if (HWIF(drive)->chipset == ide_pdc4030 && rq->buffer != NULL)
-		return -ENOSYS;  /* special drive cmds not supported */
-#endif
 	rq->errors = 0;
 	rq->rq_status = RQ_ACTIVE;
 
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	2004-10-22 02:20:30 +02:00
+++ b/drivers/ide/ide-probe.c	2004-10-22 02:20:30 +02:00
@@ -180,12 +180,6 @@
 	if (cmd == WIN_PIDENTIFY) {
 		u8 type = (id->config >> 8) & 0x1f;
 		printk("ATAPI ");
-#ifdef CONFIG_BLK_DEV_PDC4030
-		if (hwif->channel == 1 && hwif->chipset == ide_pdc4030) {
-			printk(" -- not supported on 2nd Promise port\n");
-			goto err_misc;
-		}
-#endif /* CONFIG_BLK_DEV_PDC4030 */
 		switch (type) {
 			case ide_floppy:
 				if (!strstr(id->model, "CD-ROM")) {
@@ -297,13 +291,9 @@
 		/* disable dma & overlap */
 		hwif->OUTB(0, IDE_FEATURE_REG);
 
-	if (hwif->identify != NULL) {
-		if (hwif->identify(drive))
-			return 1;
-	} else {
-		/* ask drive for ID */
-		hwif->OUTB(cmd, IDE_COMMAND_REG);
-	}
+	/* ask drive for ID */
+	hwif->OUTB(cmd, IDE_COMMAND_REG);
+
 	timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
 	timeout += jiffies;
 	do {
@@ -676,9 +666,6 @@
 		return;
 
 	if ((hwif->chipset != ide_4drives || !hwif->mate || !hwif->mate->present) &&
-#ifdef CONFIG_BLK_DEV_PDC4030
-	    (hwif->chipset != ide_pdc4030 || hwif->channel == 0) &&
-#endif /* CONFIG_BLK_DEV_PDC4030 */
 	    (ide_hwif_request_regions(hwif))) {
 		u16 msgout = 0;
 		for (unit = 0; unit < MAX_DRIVES; ++unit) {
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c	2004-10-22 02:20:30 +02:00
+++ b/drivers/ide/ide-proc.c	2004-10-22 02:20:30 +02:00
@@ -314,7 +314,6 @@
 		case ide_qd65xx:	name = "qd65xx";	break;
 		case ide_umc8672:	name = "umc8672";	break;
 		case ide_ht6560b:	name = "ht6560b";	break;
-		case ide_pdc4030:	name = "pdc4030";	break;
 		case ide_rz1000:	name = "rz1000";	break;
 		case ide_trm290:	name = "trm290";	break;
 		case ide_cmd646:	name = "cmd646";	break;
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2004-10-22 02:20:30 +02:00
+++ b/drivers/ide/ide.c	2004-10-22 02:20:30 +02:00
@@ -668,7 +668,6 @@
 	hwif->cds			= tmp_hwif->cds;
 #endif
 
-	hwif->identify			= tmp_hwif->identify;
 	hwif->tuneproc			= tmp_hwif->tuneproc;
 	hwif->speedproc			= tmp_hwif->speedproc;
 	hwif->selectproc		= tmp_hwif->selectproc;
@@ -1778,9 +1777,6 @@
 	return 0;	/* zero = nothing matched */
 }
 
-#ifdef CONFIG_BLK_DEV_PDC4030
-static int __initdata probe_pdc4030;
-#endif
 #ifdef CONFIG_BLK_DEV_ALI14XX
 static int __initdata probe_ali14xx;
 extern int ali14xx_init(void);
@@ -1949,7 +1945,7 @@
 			"noprobe", "serialize", "autotune", "noautotune", 
 			"reset", "dma", "ata66", "minus8", "minus9",
 			"minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb",
-			"dtc2278", "umc8672", "ali14xx", "dc4030", NULL };
+			"dtc2278", "umc8672", "ali14xx", NULL };
 		hw = s[3] - '0';
 		hwif = &ide_hwifs[hw];
 		i = match_parm(&s[4], ide_words, vals, 3);
@@ -1975,11 +1971,6 @@
 		}
 
 		switch (i) {
-#ifdef CONFIG_BLK_DEV_PDC4030
-			case -18: /* "dc4030" */
-				probe_pdc4030 = 1;
-				goto done;
-#endif
 #ifdef CONFIG_BLK_DEV_ALI14XX
 			case -17: /* "ali14xx" */
 				probe_ali14xx = 1;
@@ -2114,13 +2105,6 @@
 		ide_probe_for_cmd640x();
 	}
 #endif /* CONFIG_BLK_DEV_CMD640 */
-#ifdef CONFIG_BLK_DEV_PDC4030
-	{
-		extern int pdc4030_init(void);
-		if (probe_pdc4030)
-			(void)pdc4030_init();
-	}
-#endif /* CONFIG_BLK_DEV_PDC4030 */
 #ifdef CONFIG_BLK_DEV_IDE_PMAC
 	{
 		extern void pmac_ide_probe(void);
diff -Nru a/drivers/ide/legacy/Makefile b/drivers/ide/legacy/Makefile
--- a/drivers/ide/legacy/Makefile	2004-10-22 02:20:30 +02:00
+++ b/drivers/ide/legacy/Makefile	2004-10-22 02:20:30 +02:00
@@ -2,7 +2,6 @@
 obj-$(CONFIG_BLK_DEV_ALI14XX)		+= ali14xx.o
 obj-$(CONFIG_BLK_DEV_DTC2278)		+= dtc2278.o
 obj-$(CONFIG_BLK_DEV_HT6560B)		+= ht6560b.o
-obj-$(CONFIG_BLK_DEV_PDC4030)		+= pdc4030.o
 obj-$(CONFIG_BLK_DEV_QD65XX)		+= qd65xx.o
 obj-$(CONFIG_BLK_DEV_UMC8672)		+= umc8672.o
 
diff -Nru a/drivers/ide/legacy/pdc4030.c b/drivers/ide/legacy/pdc4030.c
--- a/drivers/ide/legacy/pdc4030.c	2004-10-22 02:20:30 +02:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,679 +0,0 @@
-/*  -*- linux-c -*-
- *  linux/drivers/ide/legacy/pdc4030.c		Version 0.90  May 27, 1999
- *
- *  Copyright (C) 1995-2002  Linus Torvalds & authors (see below)
- */
-
-/*
- *  Principal Author/Maintainer:  Peter Denison <promise@pnd-pc.demon.co.uk>
- *
- *  This file provides support for the second port and cache of Promise
- *  IDE interfaces, e.g. DC4030VL, DC4030VL-1 and DC4030VL-2.
- *
- *  Thanks are due to Mark Lord for advice and patiently answering stupid
- *  questions, and all those mugs^H^H^H^Hbrave souls who've tested this,
- *  especially Andre Hedrick.
- *
- *  Version 0.01	Initial version, #include'd in ide.c rather than
- *                      compiled separately.
- *                      Reads use Promise commands, writes as before. Drives
- *                      on second channel are read-only.
- *  Version 0.02        Writes working on second channel, reads on both
- *                      channels. Writes fail under high load. Suspect
- *			transfers of >127 sectors don't work.
- *  Version 0.03        Brought into line with ide.c version 5.27.
- *                      Other minor changes.
- *  Version 0.04        Updated for ide.c version 5.30
- *                      Changed initialization strategy
- *  Version 0.05	Kernel integration.  -ml
- *  Version 0.06	Ooops. Add hwgroup to direct call of ide_intr() -ml
- *  Version 0.07	Added support for DC4030 variants
- *			Secondary interface autodetection
- *  Version 0.08	Renamed to pdc4030.c
- *  Version 0.09	Obsolete - never released - did manual write request
- *			splitting before max_sectors[major][minor] available.
- *  Version 0.10	Updated for 2.1 series of kernels
- *  Version 0.11	Updated for 2.3 series of kernels
- *			Autodetection code added.
- *
- *  Version 0.90	Transition to BETA code. No lost/unexpected interrupts
- */
-
-/*
- * Once you've compiled it in, you'll have to also enable the interface
- * setup routine from the kernel command line, as in 
- *
- *	'linux ide0=dc4030' or 'linux ide1=dc4030'
- *
- * It should now work as a second controller also ('ide1=dc4030') but only
- * if you DON'T have BIOS V4.44, which has a bug. If you have this version
- * and EPROM programming facilities, you need to fix 4 bytes:
- * 	2496:	81	81
- *	2497:	3E	3E
- *	2498:	22	98	*
- *	2499:	06	05	*
- *	249A:	F0	F0
- *	249B:	01	01
- *	...
- *	24A7:	81	81
- *	24A8:	3E	3E
- *	24A9:	22	98	*
- *	24AA:	06	05	*
- *	24AB:	70	70
- *	24AC:	01	01
- *
- * As of January 1999, Promise Technology Inc. have finally supplied me with
- * some technical information which has shed a glimmer of light on some of the
- * problems I was having, especially with writes. 
- *
- * There are still potential problems with the robustness and efficiency of
- * this driver because I still don't understand what the card is doing with
- * interrupts, however, it has been stable for a while with no reports of ill
- * effects.
- */
-
-#define DEBUG_READ
-#define DEBUG_WRITE
-#define __PROMISE_4030
-
-#include <linux/module.h>
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
-#include <linux/ioport.h>
-#include <linux/blkdev.h>
-#include <linux/hdreg.h>
-#include <linux/ide.h>
-#include <linux/init.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-
-#include "pdc4030.h"
-
-static ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct
request *rq, sector_t block);
-
-/*
- * promise_selectproc() is invoked by ide.c
- * in preparation for access to the specified drive.
- */
-static void promise_selectproc (ide_drive_t *drive)
-{
-	unsigned int number;
-
-	number = (HWIF(drive)->channel << 1) + drive->select.b.unit;
-	HWIF(drive)->OUTB(number, IDE_FEATURE_REG);
-}
-
-/*
- * pdc4030_cmd handles the set of vendor specific commands that are initiated
- * by command F0. They all have the same success/failure notification -
- * 'P' (=0x50) on success, 'p' (=0x70) on failure.
- */
-int pdc4030_cmd(ide_drive_t *drive, u8 cmd)
-{
-	unsigned long timeout;
-	u8 status_val;
-
-	promise_selectproc(drive);	/* redundant? */
-	HWIF(drive)->OUTB(0xF3, IDE_SECTOR_REG);
-	HWIF(drive)->OUTB(cmd, IDE_SELECT_REG);
-	HWIF(drive)->OUTB(PROMISE_EXTENDED_COMMAND, IDE_COMMAND_REG);
-	timeout = HZ * 10;
-	timeout += jiffies;
-	do {
-		if(time_after(jiffies, timeout)) {
-			return 2; /* device timed out */
-		}
-		/* Delays at least 10ms to give interface a chance */
-		mdelay(10);
-		status_val = HWIF(drive)->INB(IDE_SECTOR_REG);
-	} while (status_val != 0x50 && status_val != 0x70);
-
-	if(status_val == 0x50)
-		return 0; /* device returned success */
-	else
-		return 1; /* device returned failure */
-}
-
-/*
- * pdc4030_identify sends a vendor-specific IDENTIFY command to the drive
- */
-int pdc4030_identify(ide_drive_t *drive)
-{
-	return pdc4030_cmd(drive, PROMISE_IDENTIFY);
-}
-
-/*
- * setup_pdc4030()
- * Completes the setup of a Promise DC4030 controller card, once found.
- */
-int __init setup_pdc4030(ide_hwif_t *hwif)
-{
-        ide_drive_t *drive;
-	ide_hwif_t *hwif2;
-	struct dc_ident ident;
-	int i;
-	ide_startstop_t startstop;
-	
-	if (!hwif) return 0;
-
-	drive = &hwif->drives[0];
-	hwif2 = &ide_hwifs[hwif->index+1];
-	if (hwif->chipset == ide_pdc4030) /* we've already been found ! */
-		return 1;
-
-	if (hwif->INB(IDE_NSECTOR_REG) == 0xFF ||
-	    hwif->INB(IDE_SECTOR_REG) == 0xFF) {
-		return 0;
-	}
-	if (IDE_CONTROL_REG)
-		hwif->OUTB(0x08, IDE_CONTROL_REG);
-	if (pdc4030_cmd(drive,PROMISE_GET_CONFIG)) {
-		return 0;
-	}
-	if (ide_wait_stat(&startstop, drive,DATA_READY,BAD_W_STAT,WAIT_DRQ)) {
-		printk(KERN_INFO
-			"%s: Failed Promise read config!\n",hwif->name);
-		return 0;
-	}
-	hwif->ata_input_data(drive, &ident, SECTOR_WORDS);
-	if (ident.id[1] != 'P' || ident.id[0] != 'T') {
-		return 0;
-	}
-	printk(KERN_INFO "%s: Promise caching controller, ",hwif->name);
-	switch(ident.type) {
-		case 0x43:	printk("DC4030VL-2, "); break;
-		case 0x41:	printk("DC4030VL-1, "); break;
-		case 0x40:	printk("DC4030VL, "); break;
-		default:
-			printk("unknown - type 0x%02x - please report!\n"
-			       ,ident.type);
-			printk("Please e-mail the following data to "
-			       "promise@pnd-pc.demon.co.uk along with\n"
-			       "a description of your card and drives:\n");
-			for (i=0; i < 0x90; i++) {
-				printk("%02x ", ((unsigned char *)&ident)[i]);
-				if ((i & 0x0f) == 0x0f) printk("\n");
-			}
-			return 0;
-	}
-	printk("%dKB cache, ",(int)ident.cache_mem);
-	switch(ident.irq) {
-            case 0x00: hwif->irq = 14; break;
-            case 0x01: hwif->irq = 12; break;
-            default:   hwif->irq = 15; break;
-	}
-	printk("on IRQ %d\n",hwif->irq);
-
-	/*
-	 * Once found and identified, we set up the next hwif in the array
-	 * (hwif2 = ide_hwifs[hwif->index+1]) with the same io ports, irq
-	 * and other settings as the main hwif. This gives us two "mated"
-	 * hwifs pointing to the Promise card.
-	 *
-	 * We also have to shift the default values for the remaining
-	 * interfaces "up by one" to make room for the second interface on the
-	 * same set of values.
-	 */
-
-	hwif->chipset	= hwif2->chipset = ide_pdc4030;
-	hwif->mate	= hwif2;
-	hwif2->mate	= hwif;
-	hwif2->channel	= 1;
-	hwif->rqsize	= hwif2->rqsize = 127;
-	hwif->no_lba48 = hwif2->no_lba48 = 1;
-	hwif->selectproc = hwif2->selectproc = &promise_selectproc;
-	hwif->serialized = hwif2->serialized = 1;
-	/* DC4030 hosted drives need their own identify... */
-	hwif->identify = hwif2->identify = &pdc4030_identify;
-
-	/* Override the normal ide disk read/write. */
-	hwif->rw_disk = promise_rw_disk;
-	hwif2->rw_disk = promise_rw_disk;
-
-	/* Shift the remaining interfaces up by one */
-	for (i=MAX_HWIFS-1 ; i > hwif->index+1 ; i--) {
-		ide_hwif_t *h = &ide_hwifs[i];
-
-#ifdef DEBUG
-		printk(KERN_DEBUG "pdc4030: Shifting i/f %d values to i/f %d\n",i-1,i);
-#endif /* DEBUG */
-		ide_init_hwif_ports(&h->hw, (h-1)->io_ports[IDE_DATA_OFFSET], 0, NULL);
-		memcpy(h->io_ports, h->hw.io_ports, sizeof(h->io_ports));
-		h->noprobe = (h-1)->noprobe;
-	}
-	ide_init_hwif_ports(&hwif2->hw, hwif->io_ports[IDE_DATA_OFFSET], 0, NULL);
-	memcpy(hwif2->io_ports, hwif->hw.io_ports, sizeof(hwif2->io_ports));
-	hwif2->irq = hwif->irq;
-	hwif2->hw.irq = hwif->hw.irq = hwif->irq;
-	for (i=0; i<2 ; i++) {
-		hwif->drives[i].io_32bit = 3;
-		hwif2->drives[i].io_32bit = 3;
-		hwif->drives[i].keep_settings = 1;
-		hwif2->drives[i].keep_settings = 1;
-		if (!ident.current_tm[i].cyl)
-			hwif->drives[i].noprobe = 1;
-		if (!ident.current_tm[i+2].cyl)
-			hwif2->drives[i].noprobe = 1;
-	}
-
-	probe_hwif_init(&ide_hwifs[hwif->index]);
-	probe_hwif_init(&ide_hwifs[hwif2->index]);
-
-	return 1;
-}
-
-/*
- * detect_pdc4030()
- * Tests for the presence of a DC4030 Promise card on this interface
- * Returns: 1 if found, 0 if not found
- */
-int __init detect_pdc4030(ide_hwif_t *hwif)
-{
-	ide_drive_t *drive = &hwif->drives[0];
-
-	if (IDE_DATA_REG == 0) { /* Skip test for non-existent interface */
-		return 0;
-	}
-	hwif->OUTB(0xF3, IDE_SECTOR_REG);
-	hwif->OUTB(0x14, IDE_SELECT_REG);
-	hwif->OUTB(PROMISE_EXTENDED_COMMAND, IDE_COMMAND_REG);
-
-	msleep(50);
-
-	if (hwif->INB(IDE_ERROR_REG) == 'P' &&
-	    hwif->INB(IDE_NSECTOR_REG) == 'T' &&
-	    hwif->INB(IDE_SECTOR_REG) == 'I') {
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-int __init pdc4030_init(void)
-{
-	unsigned int	index;
-	ide_hwif_t	*hwif;
-
-	for (index = 0; index < MAX_HWIFS; index++) {
-		hwif = &ide_hwifs[index];
-		if (hwif->chipset == ide_unknown && detect_pdc4030(hwif)) {
-			if (!setup_pdc4030(hwif))
-				return -ENODEV;
-			return 0;
-		}
-	}
-	return -ENODEV;
-}
-
-#ifdef MODULE
-module_init(pdc4030_init);
-#endif
-
-MODULE_AUTHOR("Peter Denison");
-MODULE_DESCRIPTION("Support of Promise 4030 VLB series IDE chipsets");
-MODULE_LICENSE("GPL");
-
-/*
- * promise_read_intr() is the handler for disk read/multread interrupts
- */
-static ide_startstop_t promise_read_intr (ide_drive_t *drive)
-{
-	unsigned int sectors_left, sectors_avail, nsect;
-	struct request *rq = HWGROUP(drive)->rq;
-	ata_status_t status;
-
-	status.all = HWIF(drive)->INB(IDE_STATUS_REG);
-	if (!OK_STAT(status.all, DATA_READY, BAD_R_STAT))
-		return DRIVER(drive)->error(drive, __FUNCTION__, status.all);
-
-read_again:
-	do {
-		sectors_left = HWIF(drive)->INB(IDE_NSECTOR_REG);
-		HWIF(drive)->INB(IDE_SECTOR_REG);
-	} while (HWIF(drive)->INB(IDE_NSECTOR_REG) != sectors_left);
-	sectors_avail = rq->nr_sectors - sectors_left;
-	if (!sectors_avail)
-		goto read_again;
-
-read_next:
-	nsect = rq->current_nr_sectors;
-	if (nsect > sectors_avail)
-		nsect = sectors_avail;
-	sectors_avail -= nsect;
-
-#ifdef DEBUG_READ
-	printk(KERN_DEBUG "%s: %s: sectors(%lu-%lu), rem=%lu\n",
-			  drive->name, __FUNCTION__,
-			  (unsigned long)rq->sector,
-			  (unsigned long)rq->sector + nsect - 1,
-			  (unsigned long)rq->nr_sectors - nsect);
-#endif /* DEBUG_READ */
-
-	HWIF(drive)->ata_input_data(drive, rq->buffer, nsect * SECTOR_WORDS);
-	rq->buffer += nsect<<9;
-	rq->sector += nsect;
-	rq->errors = 0;
-	rq->nr_sectors -= nsect;
-	if (!rq->current_nr_sectors)
-		DRIVER(drive)->end_request(drive, 1, 0);
-
-/*
- * Now the data has been read in, do the following:
- * 
- * if there are still sectors left in the request, 
- *   if we know there are still sectors available from the interface,
- *     go back and read the next bit of the request.
- *   else if DRQ is asserted, there are more sectors available, so
- *     go back and find out how many, then read them in.
- *   else if BUSY is asserted, we are going to get an interrupt, so
- *     set the handler for the interrupt and just return
- */
-	if (rq->nr_sectors > 0) {
-		if (sectors_avail)
-			goto read_next;
-		status.all = HWIF(drive)->INB(IDE_STATUS_REG);
-		if (status.b.drq)
-			goto read_again;
-		if (status.b.bsy) {
-			if (HWGROUP(drive)->handler != NULL)
-				BUG();
-			ide_set_handler(drive,
-					&promise_read_intr,
-					WAIT_CMD,
-					NULL);
-#ifdef DEBUG_READ
-			printk(KERN_DEBUG "%s: promise_read: waiting for"
-			       "interrupt\n", drive->name);
-#endif /* DEBUG_READ */
-			return ide_started;
-		}
-		printk(KERN_ERR "%s: Eeek! promise_read_intr: sectors left "
-		       "!DRQ !BUSY\n", drive->name);
-		return DRIVER(drive)->error(drive,
-				"promise read intr", status.all);
-	}
-	return ide_stopped;
-}
-
-/*
- * promise_complete_pollfunc()
- * This is the polling function for waiting (nicely!) until drive stops
- * being busy. It is invoked at the end of a write, after the previous poll
- * has finished.
- *
- * Once not busy, the end request is called.
- */
-static ide_startstop_t promise_complete_pollfunc(ide_drive_t *drive)
-{
-	ide_hwgroup_t *hwgroup = HWGROUP(drive);
-	struct request *rq = &hwgroup->wrq;
-	struct bio *bio = rq->bio;
-
-	if ((HWIF(drive)->INB(IDE_STATUS_REG)) & BUSY_STAT) {
-		if (time_before(jiffies, hwgroup->poll_timeout)) {
-			if (hwgroup->handler != NULL)
-				BUG();
-			ide_set_handler(drive,
-					&promise_complete_pollfunc,
-					HZ/100,
-					NULL);
-			return ide_started; /* continue polling... */
-		}
-		hwgroup->poll_timeout = 0;
-		printk(KERN_ERR "%s: completion timeout - still busy!\n",
-		       drive->name);
-		return DRIVER(drive)->error(drive, "busy timeout",
-				HWIF(drive)->INB(IDE_STATUS_REG));
-	}
-
-	hwgroup->poll_timeout = 0;
-#ifdef DEBUG_WRITE
-	printk(KERN_DEBUG "%s: Write complete - end_request\n", drive->name);
-#endif /* DEBUG_WRITE */
-
-	bio->bi_idx = bio->bi_vcnt - rq->nr_cbio_segments;
-	rq = hwgroup->rq;
-	DRIVER(drive)->end_request(drive, 1, rq->hard_nr_sectors);
-
-	return ide_stopped;
-}
-
-/*
- * promise_multwrite() transfers a block of up to mcount sectors of data
- * to a drive as part of a disk multiple-sector write operation.
- */
-static void promise_multwrite (ide_drive_t *drive, unsigned int mcount)
-{
-	ide_hwgroup_t *hwgroup	= HWGROUP(drive);
-	struct request *rq	= &hwgroup->wrq;
-
-	do {
-		char *buffer;
-		int nsect = rq->current_nr_sectors;
-
-		if (nsect > mcount)
-			nsect = mcount;
-		mcount -= nsect;
-		buffer = rq->buffer;
-
-		rq->sector += nsect;
-		rq->buffer += nsect << 9;
-		rq->nr_sectors -= nsect;
-		rq->current_nr_sectors -= nsect;
-
-		/* Do we move to the next bh after this? */
-		if (!rq->current_nr_sectors) {
-			struct bio *bio = rq->bio;
-
-			/*
-			 * only move to next bio, when we have processed
-			 * all bvecs in this one.
-			 */
-			if (++bio->bi_idx >= bio->bi_vcnt) {
-				bio->bi_idx = bio->bi_vcnt - rq->nr_cbio_segments;
-				bio = bio->bi_next;
-			}
-
-			/* end early early we ran out of requests */
-			if (!bio) {
-				mcount = 0;
-			} else {
-				rq->bio = bio;
-				rq->nr_cbio_segments = bio_segments(bio);
-				rq->current_nr_sectors = bio_cur_sectors(bio);
-				rq->hard_cur_sectors = rq->current_nr_sectors;
-			}
-		}
-
-		/*
-		 * Ok, we're all setup for the interrupt
-		 * re-entering us on the last transfer.
-		 */
-		taskfile_output_data(drive, buffer, nsect<<7);
-	} while (mcount);
-}
-
-/*
- * promise_write_pollfunc() is the handler for disk write completion polling.
- */
-static ide_startstop_t promise_write_pollfunc (ide_drive_t *drive)
-{
-	ide_hwgroup_t *hwgroup = HWGROUP(drive);
-	struct request *rq = &hwgroup->wrq;
-	struct bio *bio = rq->bio;
-
-	if (HWIF(drive)->INB(IDE_NSECTOR_REG) != 0) {
-		if (time_before(jiffies, hwgroup->poll_timeout)) {
-			if (hwgroup->handler != NULL)
-				BUG();
-			ide_set_handler(drive,
-					&promise_write_pollfunc,
-					HZ/100,
-					NULL);
-			return ide_started; /* continue polling... */
-		}
-		hwgroup->poll_timeout = 0;
-		printk(KERN_ERR "%s: write timed-out!\n",drive->name);
-		bio->bi_idx = bio->bi_vcnt - rq->nr_cbio_segments;
-		return DRIVER(drive)->error(drive, "write timeout",
-				HWIF(drive)->INB(IDE_STATUS_REG));
-	}
-
-	/*
-	 * Now write out last 4 sectors and poll for not BUSY
-	 */
-	promise_multwrite(drive, 4);
-	hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
-	if (hwgroup->handler != NULL)
-		BUG();
-	ide_set_handler(drive, &promise_complete_pollfunc, HZ/100, NULL);
-#ifdef DEBUG_WRITE
-	printk(KERN_DEBUG "%s: Done last 4 sectors - status = %02x\n",
-		drive->name, HWIF(drive)->INB(IDE_STATUS_REG));
-#endif /* DEBUG_WRITE */
-	return ide_started;
-}
-
-/*
- * promise_write() transfers a block of one or more sectors of data to a
- * drive as part of a disk write operation. All but 4 sectors are transferred
- * in the first attempt, then the interface is polled (nicely!) for completion
- * before the final 4 sectors are transferred. There is no interrupt generated
- * on writes (at least on the DC4030VL-2), we just have to poll for NOT BUSY.
- */
-static ide_startstop_t promise_write (ide_drive_t *drive)
-{
-	ide_hwgroup_t *hwgroup = HWGROUP(drive);
-	struct request *rq = &hwgroup->wrq;
-
-#ifdef DEBUG_WRITE
-	printk(KERN_DEBUG "%s: %s: sectors(%lu-%lu)\n",
-			  drive->name, __FUNCTION__,
-			  (unsigned long)rq->sector,
-			  (unsigned long)rq->sector + rq->nr_sectors - 1);
-#endif /* DEBUG_WRITE */
-
-	/*
-	 * If there are more than 4 sectors to transfer, do n-4 then go into
-	 * the polling strategy as defined above.
-	 */
-	if (rq->nr_sectors > 4) {
-		promise_multwrite(drive, rq->nr_sectors - 4);
-		hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
-		if (hwgroup->handler != NULL)	/* paranoia check */
-			BUG();
-		ide_set_handler (drive, &promise_write_pollfunc, HZ/100, NULL);
-		return ide_started;
-	} else {
-	/*
-	 * There are 4 or fewer sectors to transfer, do them all in one go
-	 * and wait for NOT BUSY.
-	 */
-		promise_multwrite(drive, rq->nr_sectors);
-		hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
-		if (hwgroup->handler != NULL)
-			BUG();
-		ide_set_handler(drive,
-				&promise_complete_pollfunc,
-				HZ/100,
-				NULL);
-
-#ifdef DEBUG_WRITE
-		printk(KERN_DEBUG "%s: promise_write: <= 4 sectors, "
-			"status = %02x\n", drive->name,
-			HWIF(drive)->INB(IDE_STATUS_REG));
-#endif /* DEBUG_WRITE */
-		return ide_started;
-	}
-}
-
-/*
- * do_pdc4030_io() is called from promise_rw_disk, having had the block number
- * already set up. It issues a READ or WRITE command to the Promise
- * controller, assuming LBA has been used to set up the block number.
- */
-ide_startstop_t do_pdc4030_io (ide_drive_t *drive, struct request *rq)
-{
-	ide_startstop_t startstop;
-	unsigned long timeout;
-	u8 stat = 0;
-
-	if (rq_data_dir(rq) == READ) {
-		HWIF(drive)->OUTB(PROMISE_READ, IDE_COMMAND_REG);
-/*
- * The card's behaviour is odd at this point. If the data is
- * available, DRQ will be true, and no interrupt will be
- * generated by the card. If this is the case, we need to call the 
- * "interrupt" handler (promise_read_intr) directly. Otherwise, if
- * an interrupt is going to occur, bit0 of the SELECT register will
- * be high, so we can set the handler the just return and be interrupted.
- * If neither of these is the case, we wait for up to 50ms (badly I'm
- * afraid!) until one of them is.
- */
-		timeout = jiffies + HZ/20; /* 50ms wait */
-		do {
-			stat = HWIF(drive)->INB(IDE_STATUS_REG);
-			if (stat & DRQ_STAT) {
-				udelay(1);
-				return promise_read_intr(drive);
-			}
-			if (HWIF(drive)->INB(IDE_SELECT_REG) & 0x01) {
-#ifdef DEBUG_READ
-				printk(KERN_DEBUG "%s: read: waiting for "
-						"interrupt\n", drive->name);
-#endif /* DEBUG_READ */
-				ide_set_handler(drive,
-						&promise_read_intr,
-						WAIT_CMD,
-						NULL);
-				return ide_started;
-			}
-			udelay(1);
-		} while (time_before(jiffies, timeout));
-
-		printk(KERN_ERR "%s: reading: No DRQ and not "
-				"waiting - Odd!\n", drive->name);
-		return ide_stopped;
-	} else {
-		HWIF(drive)->OUTB(PROMISE_WRITE, IDE_COMMAND_REG);
-		if (ide_wait_stat(&startstop, drive, DATA_READY,
-				drive->bad_wstat, WAIT_DRQ)) {
-			printk(KERN_ERR "%s: no DRQ after issuing "
-				"PROMISE_WRITE\n", drive->name);
-			return startstop;
-	    	}
-		if (!drive->unmask)
-			local_irq_disable();
-		HWGROUP(drive)->wrq = *rq; /* scratchpad */
-		return promise_write(drive);
-	}
-}
-
-static ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct
request *rq, sector_t block)
-{
-	/* The four drives on the two logical (one physical) interfaces
-	   are distinguished by writing the drive number (0-3) to the
-	   Feature register.
-	   FIXME: Is promise_selectproc now redundant??
-	*/
-	ide_hwif_t *hwif = HWIF(drive);
-	int drive_number = (hwif->channel << 1) + drive->select.b.unit;
-
-	BUG_ON(rq->nr_sectors > 127);
-
-	if (IDE_CONTROL_REG)
-		hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
-	hwif->OUTB(drive_number, IDE_FEATURE_REG);
-	hwif->OUTB(rq->nr_sectors, IDE_NSECTOR_REG);
-	hwif->OUTB(block,IDE_SECTOR_REG);
-	hwif->OUTB(block>>=8,IDE_LCYL_REG);
-	hwif->OUTB(block>>=8,IDE_HCYL_REG);
-	hwif->OUTB(((block>>8)&0x0f)|drive->select.all,IDE_SELECT_REG);
-
-	return do_pdc4030_io(drive, rq);
-}
diff -Nru a/drivers/ide/legacy/pdc4030.h b/drivers/ide/legacy/pdc4030.h
--- a/drivers/ide/legacy/pdc4030.h	2004-10-22 02:20:30 +02:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,70 +0,0 @@
-/*
- *  linux/drivers/ide/legacy/pdc4030.h
- *
- *  Copyright (C) 1995-1998  Linus Torvalds & authors
- */
-
-/*
- * Principal author: Peter Denison <peterd@pnd-pc.demon.co.uk>
- */
-
-#ifndef IDE_PROMISE_H
-#define IDE_PROMISE_H
-
-#include <linux/config.h>
-
-#ifndef CONFIG_BLK_DEV_PDC4030
-# ifdef _IDE_DISK
-
-# define IS_PDC4030_DRIVE (0)	/* auto-NULLs out pdc4030 code */
-
-ide_startstop_t promise_rw_disk(ide_drive_t *, struct request *,
unsigned long);
-
-ide_startstop_t promise_rw_disk(ide_drive_t *drive, struct request
*rq, unsigned long block)
-{
-        return ide_stopped;
-}
-# endif /* _IDE_DISK */
-#else /* CONFIG_BLK_DEV_PDC4030 */
-# ifdef _IDE_DISK
-#  define IS_PDC4030_DRIVE (HWIF(drive)->chipset == ide_pdc4030)
-
-ide_startstop_t promise_rw_disk(ide_drive_t *, struct request *,
unsigned long);
-
-# endif /* _IDE_DISK */
-#endif /* CONFIG_BLK_DEV_PDC4030 */
-
-#ifdef __PROMISE_4030
-#define	PROMISE_EXTENDED_COMMAND	0xF0
-#define	PROMISE_READ			0xF2
-#define	PROMISE_WRITE			0xF3
-/* Extended commands - main command code = 0xf0 */
-#define	PROMISE_GET_CONFIG		0x10
-#define	PROMISE_IDENTIFY		0x20
-
-struct translation_mode {
-	u16	cyl;
-	u8	head;
-	u8	sect;
-};
-
-struct dc_ident {
-	u8	type;
-	u8	unknown1;
-	u8	hw_revision;
-	u8	firmware_major;
-	u8	firmware_minor;
-	u8	bios_address;
-	u8	irq;
-	u8	unknown2;
-	u16	cache_mem;
-	u16	unknown3;
-	u8	id[2];
-	u16	info;
-	struct translation_mode current_tm[4];
-	u8	pad[SECTOR_WORDS*4 - 32];
-};
-
-#endif /* __PROMISE_4030 */
-
-#endif /* IDE_PROMISE_H */
diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
--- a/drivers/ide/pci/sgiioc4.c	2004-10-22 02:20:30 +02:00
+++ b/drivers/ide/pci/sgiioc4.c	2004-10-22 02:20:30 +02:00
@@ -602,7 +602,6 @@
 	hwif->ultra_mask = 0x0;	/* Disable Ultra DMA */
 	hwif->mwdma_mask = 0x2;	/* Multimode-2 DMA  */
 	hwif->swdma_mask = 0x2;
-	hwif->identify = NULL;
 	hwif->tuneproc = NULL;	/* Sets timing for PIO mode */
 	hwif->speedproc = NULL;	/* Sets timing for DMA &/or PIO modes */
 	hwif->selectproc = NULL;/* Use the default routine to select drive */
diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h
--- a/include/linux/blkdev.h	2004-10-22 02:20:30 +02:00
+++ b/include/linux/blkdev.h	2004-10-22 02:20:30 +02:00
@@ -125,13 +125,7 @@
 	/* no. of sectors left to complete in the current segment */
 	unsigned int hard_cur_sectors;
 
-	/* no. of segments left to submit in the current bio */
-	unsigned short nr_cbio_segments;
-	/* no. of sectors left to submit in the current bio */
-	unsigned long nr_cbio_sectors;
-
-	struct bio *cbio;		/* next bio to submit */
-	struct bio *bio;		/* next unfinished bio to complete */
+	struct bio *bio;
 	struct bio *biotail;
 
 	void *elevator_private;
@@ -465,32 +459,6 @@
  */
 #define blk_queue_headactive(q, head_active)
 
-/* current index into bio being processed for submission */
-#define blk_rq_idx(rq)	((rq)->cbio->bi_vcnt - (rq)->nr_cbio_segments)
-
-/* current bio vector being processed */
-#define blk_rq_vec(rq)	(bio_iovec_idx((rq)->cbio, blk_rq_idx(rq)))
-
-/* current offset with respect to start of the segment being submitted */
-#define blk_rq_offset(rq) \
-	(((rq)->hard_cur_sectors - (rq)->current_nr_sectors) << 9)
-
-/*
- * temporarily mapping a (possible) highmem bio (typically for PIO transfer)
- */
-
-/* Assumes rq->cbio != NULL */
-static inline char * rq_map_buffer(struct request *rq, unsigned long *flags)
-{
-	return (__bio_kmap_irq(rq->cbio, blk_rq_idx(rq), flags)
-		+ blk_rq_offset(rq));
-}
-
-static inline void rq_unmap_buffer(char *buffer, unsigned long *flags)
-{
-	__bio_kunmap_irq(buffer, flags);
-}
-
 /*
  * q->prep_rq_fn return values
  */
@@ -589,7 +557,6 @@
 extern int end_that_request_first(struct request *, int, int);
 extern int end_that_request_chunk(struct request *, int, int);
 extern void end_that_request_last(struct request *);
-extern int process_that_request_first(struct request *, unsigned int);
 extern void end_request(struct request *req, int uptodate);
 
 /*
@@ -660,7 +627,6 @@
 extern long blk_congestion_wait(int rw, long timeout);
 
 extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *);
-extern void blk_rq_prep_restart(struct request *);
 extern int blkdev_issue_flush(struct block_device *, sector_t *);
 
 #define MAX_PHYS_SEGMENTS 128
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2004-10-22 02:20:30 +02:00
+++ b/include/linux/ide.h	2004-10-22 02:20:30 +02:00
@@ -242,7 +242,7 @@
 typedef enum {	ide_unknown,	ide_generic,	ide_pci,
 		ide_cmd640,	ide_dtc2278,	ide_ali14xx,
 		ide_qd65xx,	ide_umc8672,	ide_ht6560b,
-		ide_pdc4030,	ide_rz1000,	ide_trm290,
+		ide_rz1000,	ide_trm290,
 		ide_cmd646,	ide_cy82c693,	ide_4drives,
 		ide_pmac,	ide_etrax100,	ide_acorn,
 		ide_forced
@@ -832,8 +832,6 @@
 #if 0
 	ide_hwif_ops_t	*hwifops;
 #else
-	/* routine is for HBA specific IDENTITY operations */
-	int	(*identify)(ide_drive_t *);
 	/* routine to tune PIO mode for drives */
 	void	(*tuneproc)(ide_drive_t *, u8);
 	/* routine to retune DMA modes for drives */

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-10-20 17:42 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-20 17:42 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-ide, linux-kernel

Hi,

Some more syncing with -mm:
* convert PIO code to use scatterlists
* unify ide-disk.c and ide-taskfile.c PIO code

Andrew, ide-dev will break again for a short moment.
I'll send you mail when it is fixed.

Linus, please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 Documentation/block/biodoc.txt   |    3 
 arch/cris/arch-v10/drivers/ide.c |    4 
 drivers/ide/arm/icside.c         |   27 ---
 drivers/ide/ide-disk.c           |  273 ++++-----------------------------------
 drivers/ide/ide-dma.c            |   15 --
 drivers/ide/ide-io.c             |   37 +++++
 drivers/ide/ide-probe.c          |   10 +
 drivers/ide/ide-taskfile.c       |  149 +++++++++------------
 drivers/ide/ide.c                |    3 
 drivers/ide/pci/sgiioc4.c        |   10 -
 drivers/ide/ppc/pmac.c           |   70 ++++------
 include/linux/ide.h              |   59 +-------
 12 files changed, 194 insertions(+), 466 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/10/20 1.2016)
   [ide] unify PIO code
   
   Use PIO code from ide-taskfile.c in ide-disk.c so:
   * drive status is checked after PIO read
   * request is failed if invalid data phase
     is detected during PIO write
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/20 1.2015)
   [ide] ide-disk: unify PIO write/multiwrite code
   
   Merge multwrite_intr() into write_intr().
   
   The only change in functionality is that rq->errors is
   now also cleared for multiwrite PIO (if there is no error).
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/20 1.2014)
   [ide] sg PIO for fs requests
   
   Convert CONFIG_IDE_TASKFILE_IO=n code
   to use scatterlists for PIO transfers.
   
   Fixes longstanding 'data integrity on error'
   issue and makes barriers work with PIO.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/20 1.2013)
   [ide] sg PIO for taskfile requests
   
   Use scatterlists for taskfile based PIO transfers
   instead of directly walking rq->[bio,cbio] lists.
   
   If CONFIG_IDE_TASKFILE_IO is defined
   this code will be used for fs requests.
   
   ide_pio_sector() is based on ata_pio_sector()
   from libata-core.c so kudos to Jeff.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/20 1.2012)
   [ide] always allocate hwif->sg_table
   
   Allocate hwif->sg_table in hwif_init() so it can also be used for PIO.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/20 1.2011)
   [ide] pmac: use more ide_hwif_t fields
   
   Use dmatable_dma, sg_table, sg_nents and sg_dma_direction fields
   of ide_hwif_t and remove their equivalents from pmac_ide_hwif_t.
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt
--- a/Documentation/block/biodoc.txt	2004-10-20 19:31:17 +02:00
+++ b/Documentation/block/biodoc.txt	2004-10-20 19:31:17 +02:00
@@ -1172,8 +1172,7 @@
 while (IDE for example)), where the CPU is doing the actual data
 transfer a virtual mapping is needed. If the driver supports highmem I/O,
 (Sec 1.1, (ii) ) it needs to use __bio_kmap_atomic and bio_kmap_irq to
-temporarily map a bio into the virtual address space. See how IDE handles
-this with ide_map_buffer.
+temporarily map a bio into the virtual address space.
 
 
 8. Prior/Related/Impacted patches
diff -Nru a/arch/cris/arch-v10/drivers/ide.c b/arch/cris/arch-v10/drivers/ide.c
--- a/arch/cris/arch-v10/drivers/ide.c	2004-10-20 19:31:17 +02:00
+++ b/arch/cris/arch-v10/drivers/ide.c	2004-10-20 19:31:17 +02:00
@@ -297,8 +297,10 @@
 	}
 
 	/* set up the Etrax DMA descriptors */
-	if (e100_ide_build_dmatable(drive))
+	if (e100_ide_build_dmatable(drive)) {
+		ide_map_sg(drive, rq);
 		return 1;
+	}
 
 	return 0;
 }
diff -Nru a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
--- a/drivers/ide/arm/icside.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/arm/icside.c	2004-10-20 19:31:17 +02:00
@@ -206,8 +206,6 @@
  * here, but we rely on the main IDE driver spotting that both
  * interfaces use the same IRQ, which should guarantee this.
  */
-#define NR_ENTRIES 256
-#define TABLE_SIZE (NR_ENTRIES * 8)
 
 static void icside_build_sglist(ide_drive_t *drive, struct request *rq)
 {
@@ -527,7 +525,7 @@
 	return 1;
 }
 
-static int icside_dma_init(ide_hwif_t *hwif)
+static void icside_dma_init(ide_hwif_t *hwif)
 {
 	int autodma = 0;
 
@@ -537,11 +535,6 @@
 
 	printk("    %s: SG-DMA", hwif->name);
 
-	hwif->sg_table = kmalloc(sizeof(struct scatterlist) * NR_ENTRIES,
-				 GFP_KERNEL);
-	if (!hwif->sg_table)
-		goto failed;
-
 	hwif->atapi_dma		= 1;
 	hwif->mwdma_mask	= 7; /* MW0..2 */
 	hwif->swdma_mask	= 7; /* SW0..2 */
@@ -569,24 +562,9 @@
 	hwif->drives[1].autodma = hwif->autodma;
 
 	printk(" capable%s\n", hwif->autodma ? ", auto-enable" : "");
-
-	return 1;
-
-failed:
-	printk(" disabled, unable to allocate DMA table\n");
-	return 0;
-}
-
-static void icside_dma_exit(ide_hwif_t *hwif)
-{
-	if (hwif->sg_table) {
-		kfree(hwif->sg_table);
-		hwif->sg_table = NULL;
-	}
 }
 #else
 #define icside_dma_init(hwif)	(0)
-#define icside_dma_exit(hwif)	do { } while (0)
 #endif
 
 static ide_hwif_t *icside_find_hwif(unsigned long dataport)
@@ -811,9 +789,6 @@
 
 	case ICS_TYPE_V6:
 		/* FIXME: tell IDE to stop using the interface */
-		icside_dma_exit(state->hwif[1]);
-		icside_dma_exit(state->hwif[0]);
-
 		if (ec->dma != NO_DMA)
 			free_dma(ec->dma);
 
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/ide-disk.c	2004-10-20 19:31:17 +02:00
@@ -123,216 +123,6 @@
 #ifndef CONFIG_IDE_TASKFILE_IO
 
 /*
- * read_intr() is the handler for disk read/multread interrupts
- */
-static ide_startstop_t read_intr (ide_drive_t *drive)
-{
-	ide_hwif_t *hwif	= HWIF(drive);
-	u32 i = 0, nsect	= 0, msect = drive->mult_count;
-	struct request *rq;
-	unsigned long flags;
-	u8 stat;
-	char *to;
-
-	/* new way for dealing with premature shared PCI interrupts */
-	if (!OK_STAT(stat=hwif->INB(IDE_STATUS_REG),DATA_READY,BAD_R_STAT)) {
-		if (stat & (ERR_STAT|DRQ_STAT)) {
-			return DRIVER(drive)->error(drive, "read_intr", stat);
-		}
-		/* no data yet, so wait for another interrupt */
-		ide_set_handler(drive, &read_intr, WAIT_CMD, NULL);
-		return ide_started;
-	}
-	
-read_next:
-	rq = HWGROUP(drive)->rq;
-	if (msect) {
-		if ((nsect = rq->current_nr_sectors) > msect)
-			nsect = msect;
-		msect -= nsect;
-	} else
-		nsect = 1;
-	to = ide_map_buffer(rq, &flags);
-	taskfile_input_data(drive, to, nsect * SECTOR_WORDS);
-#ifdef DEBUG
-	printk("%s:  read: sectors(%ld-%ld), buffer=0x%08lx, remaining=%ld\n",
-		drive->name, rq->sector, rq->sector+nsect-1,
-		(unsigned long) rq->buffer+(nsect<<9), rq->nr_sectors-nsect);
-#endif
-	ide_unmap_buffer(rq, to, &flags);
-	rq->sector += nsect;
-	rq->errors = 0;
-	i = (rq->nr_sectors -= nsect);
-	if (((long)(rq->current_nr_sectors -= nsect)) <= 0)
-		ide_end_request(drive, 1, rq->hard_cur_sectors);
-	/*
-	 * Another BH Page walker and DATA INTEGRITY Questioned on ERROR.
-	 * If passed back up on multimode read, BAD DATA could be ACKED
-	 * to FILE SYSTEMS above ...
-	 */
-	if (i > 0) {
-		if (msect)
-			goto read_next;
-		ide_set_handler(drive, &read_intr, WAIT_CMD, NULL);
-                return ide_started;
-	}
-        return ide_stopped;
-}
-
-/*
- * write_intr() is the handler for disk write interrupts
- */
-static ide_startstop_t write_intr (ide_drive_t *drive)
-{
-	ide_hwgroup_t *hwgroup	= HWGROUP(drive);
-	ide_hwif_t *hwif	= HWIF(drive);
-	struct request *rq	= hwgroup->rq;
-	u32 i = 0;
-	u8 stat;
-
-	if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),
-			DRIVE_READY, drive->bad_wstat)) {
-		printk("%s: write_intr error1: nr_sectors=%ld, stat=0x%02x\n",
-			drive->name, rq->nr_sectors, stat);
-        } else {
-#ifdef DEBUG
-		printk("%s: write: sector %ld, buffer=0x%08lx, remaining=%ld\n",
-			drive->name, rq->sector, (unsigned long) rq->buffer,
-			rq->nr_sectors-1);
-#endif
-		if ((rq->nr_sectors == 1) ^ ((stat & DRQ_STAT) != 0)) {
-			rq->sector++;
-			rq->errors = 0;
-			i = --rq->nr_sectors;
-			--rq->current_nr_sectors;
-			if (((long)rq->current_nr_sectors) <= 0)
-				ide_end_request(drive, 1, rq->hard_cur_sectors);
-			if (i > 0) {
-				unsigned long flags;
-				char *to = ide_map_buffer(rq, &flags);
-				taskfile_output_data(drive, to, SECTOR_WORDS);
-				ide_unmap_buffer(rq, to, &flags);
-				ide_set_handler(drive, &write_intr, WAIT_CMD, NULL);
-                                return ide_started;
-			}
-                        return ide_stopped;
-		}
-		/* the original code did this here (?) */
-		return ide_stopped;
-	}
-	return DRIVER(drive)->error(drive, "write_intr", stat);
-}
-
-/*
- * ide_multwrite() transfers a block of up to mcount sectors of data
- * to a drive as part of a disk multiple-sector write operation.
- *
- * Note that we may be called from two contexts - __ide_do_rw_disk() context
- * and IRQ context. The IRQ can happen any time after we've output the
- * full "mcount" number of sectors, so we must make sure we update the
- * state _before_ we output the final part of the data!
- *
- * The update and return to BH is a BLOCK Layer Fakey to get more data
- * to satisfy the hardware atomic segment.  If the hardware atomic segment
- * is shorter or smaller than the BH segment then we should be OKAY.
- * This is only valid if we can rewind the rq->current_nr_sectors counter.
- */
-static void ide_multwrite(ide_drive_t *drive, unsigned int mcount)
-{
- 	ide_hwgroup_t *hwgroup	= HWGROUP(drive);
- 	struct request *rq	= &hwgroup->wrq;
- 
-  	do {
-  		char *buffer;
-  		int nsect = rq->current_nr_sectors;
-		unsigned long flags;
- 
-		if (nsect > mcount)
-			nsect = mcount;
-		mcount -= nsect;
-		buffer = ide_map_buffer(rq, &flags);
-
-		rq->sector += nsect;
-		rq->nr_sectors -= nsect;
-		rq->current_nr_sectors -= nsect;
-
-		/* Do we move to the next bh after this? */
-		if (!rq->current_nr_sectors) {
-			struct bio *bio = rq->bio;
-
-			/*
-			 * only move to next bio, when we have processed
-			 * all bvecs in this one.
-			 */
-			if (++bio->bi_idx >= bio->bi_vcnt) {
-				bio->bi_idx = bio->bi_vcnt - rq->nr_cbio_segments;
-				bio = bio->bi_next;
-			}
-
-			/* end early early we ran out of requests */
-			if (!bio) {
-				mcount = 0;
-			} else {
-				rq->bio = bio;
-				rq->nr_cbio_segments = bio_segments(bio);
-				rq->current_nr_sectors = bio_cur_sectors(bio);
-				rq->hard_cur_sectors = rq->current_nr_sectors;
-			}
-		}
-
-		/*
-		 * Ok, we're all setup for the interrupt
-		 * re-entering us on the last transfer.
-		 */
-		taskfile_output_data(drive, buffer, nsect<<7);
-		ide_unmap_buffer(rq, buffer, &flags);
-	} while (mcount);
-}
-
-/*
- * multwrite_intr() is the handler for disk multwrite interrupts
- */
-static ide_startstop_t multwrite_intr (ide_drive_t *drive)
-{
-	ide_hwgroup_t *hwgroup	= HWGROUP(drive);
-	ide_hwif_t *hwif	= HWIF(drive);
-	struct request *rq	= &hwgroup->wrq;
-	struct bio *bio		= rq->bio;
-	u8 stat;
-
-	stat = hwif->INB(IDE_STATUS_REG);
-	if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) {
-		if (stat & DRQ_STAT) {
-			/*
-			 *	The drive wants data. Remember rq is the copy
-			 *	of the request
-			 */
-			if (rq->nr_sectors) {
-				ide_multwrite(drive, drive->mult_count);
-				ide_set_handler(drive, &multwrite_intr, WAIT_CMD, NULL);
-				return ide_started;
-			}
-		} else {
-			/*
-			 *	If the copy has all the blocks completed then
-			 *	we can end the original request.
-			 */
-			if (!rq->nr_sectors) {	/* all done? */
-				bio->bi_idx = bio->bi_vcnt - rq->nr_cbio_segments;
-				rq = hwgroup->rq;
-				ide_end_request(drive, 1, rq->nr_sectors);
-				return ide_stopped;
-			}
-		}
-		bio->bi_idx = bio->bi_vcnt - rq->nr_cbio_segments;
-		/* the original code did this here (?) */
-		return ide_stopped;
-	}
-	bio->bi_idx = bio->bi_vcnt - rq->nr_cbio_segments;
-	return DRIVER(drive)->error(drive, "multwrite_intr", stat);
-}
-
-/*
  * __ide_do_rw_disk() issues READ and WRITE commands to a disk,
  * using LBA if supported, or CHS otherwise, to address sectors.
  * It also takes care of issuing special DRIVE_CMDs.
@@ -352,6 +142,11 @@
 			dma = 0;
 	}
 
+	if (!dma) {
+		ide_init_sg_cmd(drive, rq);
+		ide_map_sg(drive, rq);
+	}
+
 	if (IDE_CONTROL_REG)
 		hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
 
@@ -435,44 +230,33 @@
 			return ide_started;
 		}
 		/* fallback to PIO */
+		ide_init_sg_cmd(drive, rq);
 	}
 
 	if (rq_data_dir(rq) == READ) {
-		command = ((drive->mult_count) ?
-			   ((lba48) ? WIN_MULTREAD_EXT : WIN_MULTREAD) :
-			   ((lba48) ? WIN_READ_EXT : WIN_READ));
-		ide_execute_command(drive, command, &read_intr, WAIT_CMD, NULL);
-		return ide_started;
-	} else {
-		ide_startstop_t startstop;
-
-		command = ((drive->mult_count) ?
-			   ((lba48) ? WIN_MULTWRITE_EXT : WIN_MULTWRITE) :
-			   ((lba48) ? WIN_WRITE_EXT : WIN_WRITE));
-		hwif->OUTB(command, IDE_COMMAND_REG);
 
-		if (ide_wait_stat(&startstop, drive, DATA_READY,
-				drive->bad_wstat, WAIT_DRQ)) {
-			printk(KERN_ERR "%s: no DRQ after issuing %s\n",
-				drive->name,
-				drive->mult_count ? "MULTWRITE" : "WRITE");
-			return startstop;
-		}
-		if (!drive->unmask)
-			local_irq_disable();
 		if (drive->mult_count) {
-			ide_hwgroup_t *hwgroup = HWGROUP(drive);
+			hwif->data_phase = TASKFILE_MULTI_IN;
+			command = lba48 ? WIN_MULTREAD_EXT : WIN_MULTREAD;
+		} else {
+			hwif->data_phase = TASKFILE_IN;
+			command = lba48 ? WIN_READ_EXT : WIN_READ;
+		}
 
-			hwgroup->wrq = *rq; /* scratchpad */
-			ide_set_handler(drive, &multwrite_intr, WAIT_CMD, NULL);
-			ide_multwrite(drive, drive->mult_count);
+		ide_execute_command(drive, command, &task_in_intr, WAIT_CMD, NULL);
+		return ide_started;
+	} else {
+		if (drive->mult_count) {
+			hwif->data_phase = TASKFILE_MULTI_OUT;
+			command = lba48 ? WIN_MULTWRITE_EXT : WIN_MULTWRITE;
 		} else {
-			unsigned long flags;
-			char *to = ide_map_buffer(rq, &flags);
-			ide_set_handler(drive, &write_intr, WAIT_CMD, NULL);
-			taskfile_output_data(drive, to, SECTOR_WORDS);
-			ide_unmap_buffer(rq, to, &flags);
+			hwif->data_phase = TASKFILE_OUT;
+			command = lba48 ? WIN_WRITE_EXT : WIN_WRITE;
 		}
+
+		hwif->OUTB(command, IDE_COMMAND_REG);
+
+		pre_task_out_intr(drive, rq);
 		return ide_started;
 	}
 }
@@ -516,6 +300,11 @@
 			dma = 0;
 	}
 
+	if (!dma) {
+		ide_init_sg_cmd(drive, rq);
+		ide_map_sg(drive, rq);
+	}
+
 	if (rq_data_dir(rq) == READ) {
 		task->command_type = IDE_DRIVE_TASK_IN;
 		if (dma)
@@ -779,10 +568,6 @@
 		ide_end_drive_cmd(drive, stat, err);
 		return ide_stopped;
 	}
-#ifdef CONFIG_IDE_TASKFILE_IO
-	/* make rq completion pointers new submission pointers */
-	blk_rq_prep_restart(rq);
-#endif
 
 	if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
 		/* other bits are useless when BUSY */
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/ide-dma.c	2004-10-20 19:31:17 +02:00
@@ -610,8 +610,10 @@
 		reading = 1 << 3;
 
 	/* fall back to pio! */
-	if (!ide_build_dmatable(drive, rq))
+	if (!ide_build_dmatable(drive, rq)) {
+		ide_map_sg(drive, rq);
 		return 1;
+	}
 
 	/* PRD table */
 	hwif->OUTL(hwif->dmatable_dma, hwif->dma_prdtable);
@@ -810,10 +812,6 @@
 				    hwif->dmatable_dma);
 		hwif->dmatable_cpu = NULL;
 	}
-	if (hwif->sg_table) {
-		kfree(hwif->sg_table);
-		hwif->sg_table = NULL;
-	}
 	return 1;
 }
 
@@ -846,15 +844,12 @@
 	hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev,
 						  PRD_ENTRIES * PRD_BYTES,
 						  &hwif->dmatable_dma);
-	hwif->sg_table = kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES,
-				GFP_KERNEL);
 
-	if ((hwif->dmatable_cpu) && (hwif->sg_table))
+	if (hwif->dmatable_cpu)
 		return 0;
 
-	printk(KERN_ERR "%s: -- Error, unable to allocate%s%s table(s).\n",
+	printk(KERN_ERR "%s: -- Error, unable to allocate%s DMA table(s).\n",
 		(hwif->dmatable_cpu == NULL) ? " CPU" : "",
-		(hwif->sg_table == NULL) ?  " SG DMA" : " DMA",
 		hwif->cds->name);
 
 	ide_release_dma_engine(hwif);
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/ide-io.c	2004-10-20 19:31:17 +02:00
@@ -47,6 +47,7 @@
 #include <linux/seq_file.h>
 #include <linux/device.h>
 #include <linux/kmod.h>
+#include <linux/scatterlist.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -674,6 +675,31 @@
 
 EXPORT_SYMBOL(do_special);
 
+void ide_map_sg(ide_drive_t *drive, struct request *rq)
+{
+	ide_hwif_t *hwif = drive->hwif;
+	struct scatterlist *sg = hwif->sg_table;
+
+	if ((rq->flags & REQ_DRIVE_TASKFILE) == 0) {
+		hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
+	} else {
+		sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
+		hwif->sg_nents = 1;
+	}
+}
+
+EXPORT_SYMBOL_GPL(ide_map_sg);
+
+void ide_init_sg_cmd(ide_drive_t *drive, struct request *rq)
+{
+	ide_hwif_t *hwif = drive->hwif;
+
+	hwif->nsect = hwif->nleft = rq->nr_sectors;
+	hwif->cursg = hwif->cursg_ofs = 0;
+}
+
+EXPORT_SYMBOL_GPL(ide_init_sg_cmd);
+
 /**
  *	execute_drive_command	-	issue special drive command
  *	@drive: the drive to issue th command on
@@ -696,6 +722,17 @@
 			goto done;
 
 		hwif->data_phase = args->data_phase;
+
+		switch (hwif->data_phase) {
+		case TASKFILE_MULTI_OUT:
+		case TASKFILE_OUT:
+		case TASKFILE_MULTI_IN:
+		case TASKFILE_IN:
+			ide_init_sg_cmd(drive, rq);
+			ide_map_sg(drive, rq);
+		default:
+			break;
+		}
 
 		if (args->tf_out_flags.all != 0) 
 			return flagged_taskfile(drive, args);
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/ide-probe.c	2004-10-20 19:31:17 +02:00
@@ -1246,6 +1246,16 @@
 	if (register_blkdev(hwif->major, hwif->name))
 		return 0;
 
+	if (!hwif->sg_max_nents)
+		hwif->sg_max_nents = PRD_ENTRIES;
+
+	hwif->sg_table = kmalloc(sizeof(struct scatterlist)*hwif->sg_max_nents,
+				 GFP_KERNEL);
+	if (!hwif->sg_table) {
+		printk(KERN_ERR "%s: unable to allocate SG table.\n", hwif->name);
+		goto out;
+	}
+
 	if (alloc_disks(hwif) < 0)
 		goto out;
 	
diff -Nru a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
--- a/drivers/ide/ide-taskfile.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/ide-taskfile.c	2004-10-20 19:31:17 +02:00
@@ -5,7 +5,7 @@
  *  Copyright (C) 2000-2002	Andre Hedrick <andre@linux-ide.org>
  *  Copyright (C) 2001-2002	Klaus Smolin
  *					IBM Storage Technology Division
- *  Copyright (C) 2003		Bartlomiej Zolnierkiewicz
+ *  Copyright (C) 2003-2004	Bartlomiej Zolnierkiewicz
  *
  *  The big the bad and the ugly.
  *
@@ -253,73 +253,6 @@
 
 EXPORT_SYMBOL(task_no_data_intr);
 
-static void task_buffer_sectors(ide_drive_t *drive, struct request *rq,
-				unsigned nsect, unsigned rw)
-{
-	char *buf = rq->buffer + blk_rq_offset(rq);
-
-	rq->sector += nsect;
-	rq->current_nr_sectors -= nsect;
-	rq->nr_sectors -= nsect;
-	__task_sectors(drive, buf, nsect, rw);
-}
-
-static inline void task_buffer_multi_sectors(ide_drive_t *drive,
-					     struct request *rq, unsigned rw)
-{
-	unsigned int msect = drive->mult_count, nsect;
-
-	nsect = rq->current_nr_sectors;
-	if (nsect > msect)
-		nsect = msect;
-
-	task_buffer_sectors(drive, rq, nsect, rw);
-}
-
-#ifdef CONFIG_IDE_TASKFILE_IO
-static void task_sectors(ide_drive_t *drive, struct request *rq,
-			 unsigned nsect, unsigned rw)
-{
-	if (rq->cbio) {	/* fs request */
-		rq->errors = 0;
-		task_bio_sectors(drive, rq, nsect, rw);
-	} else		/* task request */
-		task_buffer_sectors(drive, rq, nsect, rw);
-}
-
-static inline void task_bio_multi_sectors(ide_drive_t *drive,
-					  struct request *rq, unsigned rw)
-{
-	unsigned int nsect, msect = drive->mult_count;
-
-	do {
-		nsect = rq->current_nr_sectors;
-		if (nsect > msect)
-			nsect = msect;
-
-		task_bio_sectors(drive, rq, nsect, rw);
-
-		if (!rq->nr_sectors)
-			msect = 0;
-		else
-			msect -= nsect;
-	} while (msect);
-}
-
-static void task_multi_sectors(ide_drive_t *drive,
-			       struct request *rq, unsigned rw)
-{
-	if (rq->cbio) {	/* fs request */
-		rq->errors = 0;
-		task_bio_multi_sectors(drive, rq, rw);
-	} else		/* task request */
-		task_buffer_multi_sectors(drive, rq, rw);
-}
-#else
-# define task_sectors(d, rq, nsect, rw)	task_buffer_sectors(d, rq, nsect, rw)
-# define task_multi_sectors(d, rq, rw)	task_buffer_multi_sectors(d, rq, rw)
-#endif /* CONFIG_IDE_TASKFILE_IO */
-
 static u8 wait_drive_not_busy(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
@@ -340,37 +273,86 @@
 	return stat;
 }
 
+static void ide_pio_sector(ide_drive_t *drive, unsigned int write)
+{
+	ide_hwif_t *hwif = drive->hwif;
+	struct scatterlist *sg = hwif->sg_table;
+	struct page *page;
+#ifdef CONFIG_HIGHMEM
+	unsigned long flags;
+#endif
+	u8 *buf;
+
+	page = sg[hwif->cursg].page;
+#ifdef CONFIG_HIGHMEM
+	local_irq_save(flags);
+#endif
+	buf = kmap_atomic(page, KM_BIO_SRC_IRQ) +
+	      sg[hwif->cursg].offset + (hwif->cursg_ofs * SECTOR_SIZE);
+
+	hwif->nleft--;
+	hwif->cursg_ofs++;
+
+	if ((hwif->cursg_ofs * SECTOR_SIZE) == sg[hwif->cursg].length) {
+		hwif->cursg++;
+		hwif->cursg_ofs = 0;
+	}
+
+	/* do the actual data transfer */
+	if (write)
+		taskfile_output_data(drive, buf, SECTOR_WORDS);
+	else
+		taskfile_input_data(drive, buf, SECTOR_WORDS);
+
+	kunmap_atomic(page, KM_BIO_SRC_IRQ);
+#ifdef CONFIG_HIGHMEM
+	local_irq_restore(flags);
+#endif
+}
+
+static void ide_pio_multi(ide_drive_t *drive, unsigned int write)
+{
+	unsigned int nsect;
+
+	nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count);
+	while (nsect--)
+		ide_pio_sector(drive, write);
+}
+
 static inline void ide_pio_datablock(ide_drive_t *drive, struct request *rq,
 				     unsigned int write)
 {
+	if (rq->bio)	/* fs request */
+		rq->errors = 0;
+
 	switch (drive->hwif->data_phase) {
 	case TASKFILE_MULTI_IN:
 	case TASKFILE_MULTI_OUT:
-		task_multi_sectors(drive, rq, write);
+		ide_pio_multi(drive, write);
 		break;
 	default:
-		task_sectors(drive, rq, 1, write);
+		ide_pio_sector(drive, write);
 		break;
 	}
 }
 
-#ifdef CONFIG_IDE_TASKFILE_IO
 static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
 				  const char *s, u8 stat)
 {
 	if (rq->bio) {
-		int sectors = rq->hard_nr_sectors - rq->nr_sectors;
+		ide_hwif_t *hwif = drive->hwif;
+		int sectors = hwif->nsect - hwif->nleft;
 
-		switch (drive->hwif->data_phase) {
+		switch (hwif->data_phase) {
 		case TASKFILE_IN:
-			if (rq->nr_sectors)
+			if (hwif->nleft)
 				break;
 			/* fall through */
 		case TASKFILE_OUT:
 			sectors--;
 			break;
 		case TASKFILE_MULTI_IN:
-			if (rq->nr_sectors)
+			if (hwif->nleft)
 				break;
 			/* fall through */
 		case TASKFILE_MULTI_OUT:
@@ -384,9 +366,6 @@
 	}
 	return drive->driver->error(drive, s, stat);
 }
-#else
-# define task_error(d, rq, s, stat) drive->driver->error(d, s, stat)
-#endif
 
 static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
 {
@@ -407,9 +386,11 @@
  */
 ide_startstop_t task_in_intr (ide_drive_t *drive)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	struct request *rq = HWGROUP(drive)->rq;
-	u8 stat = HWIF(drive)->INB(IDE_STATUS_REG);
+	u8 stat = hwif->INB(IDE_STATUS_REG);
 
+	/* new way for dealing with premature shared PCI interrupts */
 	if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
 		if (stat & (ERR_STAT | DRQ_STAT))
 			return task_error(drive, rq, __FUNCTION__, stat);
@@ -421,7 +402,7 @@
 	ide_pio_datablock(drive, rq, 0);
 
 	/* If it was the last datablock check status and finish transfer. */
-	if (!rq->nr_sectors) {
+	if (!hwif->nleft) {
 		stat = wait_drive_not_busy(drive);
 		if (!OK_STAT(stat, 0, BAD_R_STAT))
 			return task_error(drive, rq, __FUNCTION__, stat);
@@ -441,18 +422,18 @@
  */
 ide_startstop_t task_out_intr (ide_drive_t *drive)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	struct request *rq = HWGROUP(drive)->rq;
-	u8 stat;
+	u8 stat = hwif->INB(IDE_STATUS_REG);
 
-	stat = HWIF(drive)->INB(IDE_STATUS_REG);
 	if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
 		return task_error(drive, rq, __FUNCTION__, stat);
 
 	/* Deal with unexpected ATA data phase. */
-	if (((stat & DRQ_STAT) == 0) ^ !rq->nr_sectors)
+	if (((stat & DRQ_STAT) == 0) ^ !hwif->nleft)
 		return task_error(drive, rq, __FUNCTION__, stat);
 
-	if (!rq->nr_sectors) {
+	if (!hwif->nleft) {
 		task_end_request(drive, rq, stat);
 		return ide_stopped;
 	}
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/ide.c	2004-10-20 19:31:17 +02:00
@@ -712,6 +712,8 @@
 	hwif->INSW			= tmp_hwif->INSW;
 	hwif->INSL			= tmp_hwif->INSL;
 
+	hwif->sg_max_nents		= tmp_hwif->sg_max_nents;
+
 	hwif->mmio			= tmp_hwif->mmio;
 	hwif->rqsize			= tmp_hwif->rqsize;
 	hwif->no_lba48			= tmp_hwif->no_lba48;
@@ -900,6 +902,7 @@
 		hwif->drives[i].disk = NULL;
 		put_disk(disk);
 	}
+	kfree(hwif->sg_table);
 	unregister_blkdev(hwif->major, hwif->name);
 	spin_lock_irq(&ide_lock);
 
diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
--- a/drivers/ide/pci/sgiioc4.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/pci/sgiioc4.c	2004-10-20 19:31:17 +02:00
@@ -404,11 +404,7 @@
 	if (!hwif->dmatable_cpu)
 		goto dma_alloc_failure;
 
-	hwif->sg_table =
-	    kmalloc(sizeof (struct scatterlist) * IOC4_PRD_ENTRIES, GFP_KERNEL);
-
-	if (!hwif->sg_table)
-		goto dma_sgalloc_failure;
+	hwif->sg_max_nents = IOC4_PRD_ENTRIES;
 
 	hwif->dma_base2 = (unsigned long)
 		pci_alloc_consistent(hwif->pci_dev,
@@ -421,9 +417,6 @@
 	return;
 
 dma_base2alloc_failure:
-	kfree(hwif->sg_table);
-
-dma_sgalloc_failure:
 	pci_free_consistent(hwif->pci_dev,
 			    IOC4_PRD_ENTRIES * IOC4_PRD_BYTES,
 			    hwif->dmatable_cpu, hwif->dmatable_dma);
@@ -584,6 +577,7 @@
 
 	if (!(count = sgiioc4_build_dma_table(drive, rq, ddir))) {
 		/* try PIO instead of DMA */
+		ide_map_sg(drive, rq);
 		return 1;
 	}
 
diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
--- a/drivers/ide/ppc/pmac.c	2004-10-20 19:31:17 +02:00
+++ b/drivers/ide/ppc/pmac.c	2004-10-20 19:31:17 +02:00
@@ -78,10 +78,6 @@
 	 */
 	volatile struct dbdma_regs __iomem *	dma_regs;
 	struct dbdma_cmd*		dma_table_cpu;
-	dma_addr_t			dma_table_dma;
-	struct scatterlist*		sg_table;
-	int				sg_nents;
-	int				sg_dma_direction;
 #endif
 	
 } pmac_ide_hwif_t;
@@ -1245,6 +1241,8 @@
 		hwif->noprobe = 0;
 #endif /* CONFIG_PMAC_PBOOK */
 
+	hwif->sg_max_nents = MAX_DCMDS;
+
 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
 	/* has a DBDMA controller channel */
 	if (pmif->dma_regs)
@@ -1562,26 +1560,23 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
 
 /*
- * This is very close to the generic ide-dma version of the function except
- * that we don't use the fields in the hwif but our own copies for sg_table
- * and friends. We build & map the sglist for a given request
+ * We build & map the sglist for a given request.
  */
 static int __pmac
 pmac_ide_build_sglist(ide_drive_t *drive, struct request *rq)
 {
 	ide_hwif_t *hwif = HWIF(drive);
-	pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
-	struct scatterlist *sg = pmif->sg_table;
+	struct scatterlist *sg = hwif->sg_table;
 	int nents;
 
 	nents = blk_rq_map_sg(drive->queue, rq, sg);
 		
 	if (rq_data_dir(rq) == READ)
-		pmif->sg_dma_direction = PCI_DMA_FROMDEVICE;
+		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
 	else
-		pmif->sg_dma_direction = PCI_DMA_TODEVICE;
+		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
 
-	return pci_map_sg(hwif->pci_dev, sg, nents, pmif->sg_dma_direction);
+	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
 }
 
 /*
@@ -1591,18 +1586,17 @@
 pmac_ide_raw_build_sglist(ide_drive_t *drive, struct request *rq)
 {
 	ide_hwif_t *hwif = HWIF(drive);
-	pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
-	struct scatterlist *sg = pmif->sg_table;
+	struct scatterlist *sg = hwif->sg_table;
 	int nents = 0;
 	ide_task_t *args = rq->special;
 	unsigned char *virt_addr = rq->buffer;
 	int sector_count = rq->nr_sectors;
 
 	if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
-		pmif->sg_dma_direction = PCI_DMA_TODEVICE;
+		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
 	else
-		pmif->sg_dma_direction = PCI_DMA_FROMDEVICE;
-	
+		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
+
 	if (sector_count > 128) {
 		sg_init_one(&sg[nents], virt_addr, 128 * SECTOR_SIZE);
 		nents++;
@@ -1611,8 +1605,8 @@
 	}
 	sg_init_one(&sg[nents], virt_addr, sector_count * SECTOR_SIZE);
 	nents++;
-   
-	return pci_map_sg(hwif->pci_dev, sg, nents, pmif->sg_dma_direction);
+
+	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
 }
 
 /*
@@ -1640,14 +1634,14 @@
 
 	/* Build sglist */
 	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE)
-		pmif->sg_nents = i = pmac_ide_raw_build_sglist(drive, rq);
+		hwif->sg_nents = i = pmac_ide_raw_build_sglist(drive, rq);
 	else
-		pmif->sg_nents = i = pmac_ide_build_sglist(drive, rq);
+		hwif->sg_nents = i = pmac_ide_build_sglist(drive, rq);
 	if (!i)
 		return 0;
 
 	/* Build DBDMA commands list */
-	sg = pmif->sg_table;
+	sg = hwif->sg_table;
 	while (i && sg_dma_len(sg)) {
 		u32 cur_addr;
 		u32 cur_len;
@@ -1692,16 +1686,16 @@
 		memset(table, 0, sizeof(struct dbdma_cmd));
 		st_le16(&table->command, DBDMA_STOP);
 		mb();
-		writel(pmif->dma_table_dma, &dma->cmdptr);
+		writel(hwif->dmatable_dma, &dma->cmdptr);
 		return 1;
 	}
 
 	printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name);
  use_pio_instead:
 	pci_unmap_sg(hwif->pci_dev,
-		     pmif->sg_table,
-		     pmif->sg_nents,
-		     pmif->sg_dma_direction);
+		     hwif->sg_table,
+		     hwif->sg_nents,
+		     hwif->sg_dma_direction);
 	return 0; /* revert to PIO for this request */
 }
 
@@ -1709,14 +1703,14 @@
 static void __pmac
 pmac_ide_destroy_dmatable (ide_drive_t *drive)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	struct pci_dev *dev = HWIF(drive)->pci_dev;
-	pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
-	struct scatterlist *sg = pmif->sg_table;
-	int nents = pmif->sg_nents;
+	struct scatterlist *sg = hwif->sg_table;
+	int nents = hwif->sg_nents;
 
 	if (nents) {
-		pci_unmap_sg(dev, sg, nents, pmif->sg_dma_direction);
-		pmif->sg_nents = 0;
+		pci_unmap_sg(dev, sg, nents, hwif->sg_dma_direction);
+		hwif->sg_nents = 0;
 	}
 }
 
@@ -1891,8 +1885,10 @@
 		return 1;
 	ata4 = (pmif->kind == controller_kl_ata4);	
 
-	if (!pmac_ide_build_dmatable(drive, rq))
+	if (!pmac_ide_build_dmatable(drive, rq)) {
+		ide_map_sg(drive, rq);
 		return 1;
+	}
 
 	/* Apple adds 60ns to wrDataSetup on reads */
 	if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
@@ -2065,21 +2061,13 @@
 	pmif->dma_table_cpu = (struct dbdma_cmd*)pci_alloc_consistent(
 		hwif->pci_dev,
 		(MAX_DCMDS + 2) * sizeof(struct dbdma_cmd),
-		&pmif->dma_table_dma);
+		&hwif->dmatable_dma);
 	if (pmif->dma_table_cpu == NULL) {
 		printk(KERN_ERR "%s: unable to allocate DMA command list\n",
 		       hwif->name);
 		return;
 	}
 
-	pmif->sg_table = kmalloc(sizeof(struct scatterlist) * MAX_DCMDS,
-				 GFP_KERNEL);
-	if (pmif->sg_table == NULL) {
-		pci_free_consistent(	hwif->pci_dev,
-					(MAX_DCMDS + 2) * sizeof(struct dbdma_cmd),
-				    	pmif->dma_table_cpu, pmif->dma_table_dma);
-		return;
-	}
 	hwif->ide_dma_off_quietly = &__ide_dma_off_quietly;
 	hwif->ide_dma_on = &__ide_dma_on;
 	hwif->ide_dma_check = &pmac_ide_dma_check;
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2004-10-20 19:31:17 +02:00
+++ b/include/linux/ide.h	2004-10-20 19:31:17 +02:00
@@ -789,27 +789,6 @@
 	struct gendisk *disk;
 } ide_drive_t;
 
-/*
- * mapping stuff, prepare for highmem...
- * 
- * temporarily mapping a (possible) highmem bio for PIO transfer
- */
-#ifndef CONFIG_IDE_TASKFILE_IO
-
-#define ide_rq_offset(rq) \
-	(((rq)->hard_cur_sectors - (rq)->current_nr_sectors) << 9)
-
-static inline void *ide_map_buffer(struct request *rq, unsigned long *flags)
-{
-	return bio_kmap_irq(rq->bio, flags) + ide_rq_offset(rq);
-}
-
-static inline void ide_unmap_buffer(struct request *rq, char *buffer,
unsigned long *flags)
-{
-	bio_kunmap_irq(buffer, flags);
-}
-#endif /* !CONFIG_IDE_TASKFILE_IO */
-
 #define IDE_CHIPSET_PCI_MASK	\
     ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))
 #define IDE_CHIPSET_IS_PCI(c)	((IDE_CHIPSET_PCI_MASK >> (c)) & 1)
@@ -920,12 +899,18 @@
 	dma_addr_t	dmatable_dma;
 	/* Scatter-gather list used to build the above */
 	struct scatterlist *sg_table;
+	int sg_max_nents;		/* Maximum number of entries in it */
 	int sg_nents;			/* Current number of entries in it */
 	int sg_dma_direction;		/* dma transfer direction */
 
 	/* data phase of the active command (currently only valid for PIO/DMA) */
 	int		data_phase;
 
+	unsigned int nsect;
+	unsigned int nleft;
+	unsigned int cursg;
+	unsigned int cursg_ofs;
+
 	int		mmio;		/* hosts iomio (0) or custom (2) select */
 	int		rqsize;		/* max sectors per request */
 	int		irq;		/* our irq number */
@@ -1369,35 +1354,6 @@
 extern void taskfile_input_data(ide_drive_t *, void *, u32);
 extern void taskfile_output_data(ide_drive_t *, void *, u32);
 
-#define IDE_PIO_IN	0
-#define IDE_PIO_OUT	1
-
-static inline void __task_sectors(ide_drive_t *drive, char *buf,
-				  unsigned nsect, unsigned rw)
-{
-	/*
-	 * IRQ can happen instantly after reading/writing
-	 * last sector of the datablock.
-	 */
-	if (rw == IDE_PIO_OUT)
-		taskfile_output_data(drive, buf, nsect * SECTOR_WORDS);
-	else
-		taskfile_input_data(drive, buf, nsect * SECTOR_WORDS);
-}
-
-#ifdef CONFIG_IDE_TASKFILE_IO
-static inline void task_bio_sectors(ide_drive_t *drive, struct request *rq,
-				    unsigned nsect, unsigned rw)
-{
-	unsigned long flags;
-	char *buf = rq_map_buffer(rq, &flags);
-
-	process_that_request_first(rq, nsect);
-	__task_sectors(drive, buf, nsect, rw);
-	rq_unmap_buffer(buf, &flags);
-}
-#endif /* CONFIG_IDE_TASKFILE_IO */
-
 extern int drive_is_ready(ide_drive_t *);
 extern int wait_for_ready(ide_drive_t *, int /* timeout */);
 
@@ -1527,6 +1483,9 @@
 
 extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
 extern void ide_setup_pci_devices(struct pci_dev *, struct pci_dev *,
ide_pci_device_t *);
+
+void ide_map_sg(ide_drive_t *, struct request *);
+void ide_init_sg_cmd(ide_drive_t *, struct request *);
 
 #define BAD_DMA_DRIVE		0
 #define GOOD_DMA_DRIVE		1

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [BK PATCHES] ide-2.6 update
@ 2004-10-19 20:47 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 53+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-19 20:47 UTC (permalink / raw)
  To: torvalds; +Cc: linux-ide, linux-kernel

Hi,

DMA cleanups/fixups that have been in -mm for almost a month.

Please do a

	bk pull bk://bart.bkbits.net/ide-2.6

This will update the following files:

 arch/cris/arch-v10/drivers/ide.c |  150 ++++++++++-----------------------------
 drivers/ide/arm/icside.c         |   97 +++----------------------
 drivers/ide/ide-cd.c             |   15 +--
 drivers/ide/ide-disk.c           |   22 ++++-
 drivers/ide/ide-dma.c            |  105 +++++----------------------
 drivers/ide/ide-floppy.c         |   12 +--
 drivers/ide/ide-tape.c           |   10 --
 drivers/ide/ide-taskfile.c       |   18 ++--
 drivers/ide/ide.c                |    6 -
 drivers/ide/pci/alim15x3.c       |   21 ++---
 drivers/ide/pci/hpt366.c         |    8 +-
 drivers/ide/pci/ns87415.c        |   18 ----
 drivers/ide/pci/pdc202xx_old.c   |    6 -
 drivers/ide/pci/sgiioc4.c        |   45 ++++-------
 drivers/ide/pci/sl82c105.c       |    8 --
 drivers/ide/pci/trm290.c         |   97 +++++--------------------
 drivers/ide/ppc/pmac.c           |   89 +++--------------------
 drivers/scsi/ide-scsi.c          |   12 +--
 include/linux/ide.h              |   12 +--
 include/linux/scatterlist.h      |   14 +++
 20 files changed, 219 insertions(+), 546 deletions(-)

through these ChangeSets:

<bzolnier@trik.(none)> (04/10/19 1.2071)
   [ide] convert ide_hwif_t->ide_dma_begin() to ->dma_start()
   
   Make ->ide_dma_begin() functions void and rename them to ->dma_start().
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/19 1.2070)
   [ide] add ide_hwif_t->dma_exec_cmd()
   
   * split off ->dma_exec_cmd() from ->ide_dma_[read,write] functions
   * choose command to execute by ->dma_exec_cmd() in higher layers
     and remove ->ide_dma_[read,write]
   * in Etrax ide.c driver REQ_DRIVE_TASKFILE requests weren't
     handled properly for drive->addressing == 0
   * in trm290.c read and write commands were interchanged
   * in sgiioc4.c commands weren't sent to disk devices
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/19 1.2069)
   [ide] add ide_hwif_t->dma_setup()
   
   * tag REQ_DRIVE_TASKFILE write requests with REQ_RW
   * split off ->dma_setup() from ->ide_dma_[read,write] functions
   * use ->dma_setup() directly in ATAPI drivers and remove media
     checks from ->ide_dma_[read,write]
   * ->ide_dma_[read,write,begin] cannot fail now
   * in Etrax ide.c setup DMA for ATAPI devices before sending
     command to drive (so setup order is the same as for disks)
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

<bzolnier@trik.(none)> (04/10/19 1.2068)
   [ide] add sg_init_one() helper and teach ide about it
   
   Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/arch/cris/arch-v10/drivers/ide.c b/arch/cris/arch-v10/drivers/ide.c
--- a/arch/cris/arch-v10/drivers/ide.c	2004-10-19 22:11:26 +02:00
+++ b/arch/cris/arch-v10/drivers/ide.c	2004-10-19 22:11:26 +02:00
@@ -30,6 +30,7 @@
 #include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/init.h>
+#include <linux/scatterlist.h>
 
 #include <asm/io.h>
 #include <asm/arch/svinto.h>
@@ -207,10 +208,8 @@
 #define ATA_PIO0_HOLD    4
 
 static int e100_dma_check (ide_drive_t *drive);
-static int e100_dma_begin (ide_drive_t *drive);
+static void e100_dma_start(ide_drive_t *drive);
 static int e100_dma_end (ide_drive_t *drive);
-static int e100_dma_read (ide_drive_t *drive);
-static int e100_dma_write (ide_drive_t *drive);
 static void e100_ide_input_data (ide_drive_t *drive, void *, unsigned int);
 static void e100_ide_output_data (ide_drive_t *drive, void *, unsigned int);
 static void e100_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
@@ -281,6 +280,38 @@
 	}
 }
 
+static int e100_dma_setup(ide_drive_t *drive)
+{
+	struct request *rq = drive->hwif->hwgroup->rq;
+
+	if (rq_data_dir(rq)) {
+		e100_read_command = 0;
+
+		RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck
so we need to do this */
+		WAIT_DMA(ATA_TX_DMA_NBR);
+	} else {
+		e100_read_command = 1;
+
+		RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck
so we need to do this */
+		WAIT_DMA(ATA_RX_DMA_NBR);
+	}
+
+	/* set up the Etrax DMA descriptors */
+	if (e100_ide_build_dmatable(drive))
+		return 1;
+
+	return 0;
+}
+
+static void e100_dma_exec_cmd(ide_drive_t *drive, u8 command)
+{
+	/* set the irq handler which will finish the request when DMA is done */
+	ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
+
+	/* issue cmd to drive */
+	etrax100_ide_outb(command, IDE_COMMAND_REG);
+}
+
 void __init
 init_e100_ide (void)
 {
@@ -302,9 +333,9 @@
                 hwif->atapi_output_bytes = &e100_atapi_output_bytes;
                 hwif->ide_dma_check = &e100_dma_check;
                 hwif->ide_dma_end = &e100_dma_end;
-		hwif->ide_dma_write = &e100_dma_write;
-		hwif->ide_dma_read = &e100_dma_read;
-		hwif->ide_dma_begin = &e100_dma_begin;
+		hwif->dma_setup = &e100_dma_setup;
+		hwif->dma_exec_cmd = &e100_dma_exec_cmd;
+		hwif->dma_start = &e100_dma_start;
 		hwif->OUTB = &etrax100_ide_outb;
 		hwif->OUTW = &etrax100_ide_outw;
 		hwif->OUTBSYNC = &etrax100_ide_outbsync;
@@ -624,12 +655,7 @@
 	ata_tot_size = 0;
 
 	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) {
-		u8 *virt_addr = rq->buffer;
-		int sector_count = rq->nr_sectors;
-		memset(&sg[0], 0, sizeof(*sg));
-		sg[0].page = virt_to_page(virt_addr);
-		sg[0].offset = offset_in_page(virt_addr);
-		sg[0].length =  sector_count  * SECTOR_SIZE;
+		sg_init_one(&sg[0], rq->buffer, rq->nr_sectors * SECTOR_SIZE);
 		hwif->sg_nents = i = 1;
 	}
 	else
@@ -773,10 +799,6 @@
  * sector address using CHS or LBA.  All that remains is to prepare for DMA
  * and then issue the actual read/write DMA/PIO command to the drive.
  *
- * For ATAPI devices, we just prepare for DMA and return. The caller should
- * then issue the packet command to the drive and call us again with
- * ide_dma_begin afterwards.
- *
  * Returns 0 if all went well.
  * Returns 1 if DMA read/write could not be started, in which case
  * the caller should revert to PIO for the current request.
@@ -793,35 +815,9 @@
 	return 0;
 }
 
-static int e100_start_dma(ide_drive_t *drive, int atapi, int reading)
+static void e100_dma_start(ide_drive_t *drive)
 {
-	if(reading) {
-
-		RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck
so we need to do this */
-		WAIT_DMA(ATA_RX_DMA_NBR);
-
-		/* set up the Etrax DMA descriptors */
-
-		if(e100_ide_build_dmatable (drive))
-			return 1;
-
-		if(!atapi) {
-			/* set the irq handler which will finish the request when DMA is done */
-
-			ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
-
-			/* issue cmd to drive */
-                        if ((HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASKFILE) &&
-			    (drive->addressing == 1)) {
-				ide_task_t *args = HWGROUP(drive)->rq->special;
-				etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
-			} else if (drive->addressing) {
-				etrax100_ide_outb(WIN_READDMA_EXT, IDE_COMMAND_REG);
-			} else {
-				etrax100_ide_outb(WIN_READDMA, IDE_COMMAND_REG);
-			}
-		}
-
+	if (e100_read_command) {
 		/* begin DMA */
 
 		/* need to do this before RX DMA due to a chip bug
@@ -854,32 +850,6 @@
 
 	} else {
 		/* writing */
-
-		RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck
so we need to do this */
-		WAIT_DMA(ATA_TX_DMA_NBR);
-
-		/* set up the Etrax DMA descriptors */
-
-		if(e100_ide_build_dmatable (drive))
-			return 1;
-
-		if(!atapi) {
-			/* set the irq handler which will finish the request when DMA is done */
-
-			ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
-
-			/* issue cmd to drive */
-			if ((HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASKFILE) &&
-			    (drive->addressing == 1)) {
-				ide_task_t *args = HWGROUP(drive)->rq->special;
-				etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
-			} else if (drive->addressing) {
-				etrax100_ide_outb(WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
-			} else {
-				etrax100_ide_outb(WIN_WRITEDMA, IDE_COMMAND_REG);
-			}
-		}
-
 		/* begin DMA */
 
 		*R_DMA_CH2_FIRST = virt_to_phys(ata_descrs);
@@ -902,44 +872,4 @@
 
 		D(printk("dma write of %d bytes.\n", ata_tot_size));
 	}
-	return 0;
-}
-
-static int e100_dma_write(ide_drive_t *drive)
-{
-	e100_read_command = 0;
-	/* ATAPI-devices (not disks) first call ide_dma_read/write to set
the direction
-	 * then they call ide_dma_begin after they have issued the
appropriate drive command
-	 * themselves to actually start the chipset DMA. so we just return
here if we're
-	 * not a diskdrive.
-	 */
-	if (drive->media != ide_disk)
-                return 0;
-	return e100_start_dma(drive, 0, 0);
-}
-
-static int e100_dma_read(ide_drive_t *drive)
-{
-	e100_read_command = 1;
-	/* ATAPI-devices (not disks) first call ide_dma_read/write to set
the direction
-	 * then they call ide_dma_begin after they have issued the
appropriate drive command
-	 * themselves to actually start the chipset DMA. so we just return
here if we're
-	 * not a diskdrive.
-	 */
-	if (drive->media != ide_disk)
-                return 0;
-	return e100_start_dma(drive, 0, 1);
-}
-
-static int e100_dma_begin(ide_drive_t *drive)
-{
-	/* begin DMA, used by ATAPI devices which want to issue the
-	 * appropriate IDE command themselves.
-	 *
-	 * they have already called ide_dma_read/write to set the
-	 * static reading flag, now they call ide_dma_begin to do
-	 * the real stuff. we tell our code below not to issue
-	 * any IDE commands itself and jump into it.
-	 */
-	 return e100_start_dma(drive, 1, e100_read_command);
 }
diff -Nru a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
--- a/drivers/ide/arm/icside.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/arm/icside.c	2004-10-19 22:11:26 +02:00
@@ -16,6 +16,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/device.h>
 #include <linux/init.h>
+#include <linux/scatterlist.h>
 
 #include <asm/dma.h>
 #include <asm/ecard.h>
@@ -223,10 +224,7 @@
 		else
 			hwif->sg_dma_direction = DMA_FROM_DEVICE;
 
-		memset(sg, 0, sizeof(*sg));
-		sg->page   = virt_to_page(rq->buffer);
-		sg->offset = offset_in_page(rq->buffer);
-		sg->length = rq->nr_sectors * SECTOR_SIZE;
+		sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
 		nents = 1;
 	} else {
 		nents = blk_rq_map_sg(drive->queue, rq, sg);
@@ -402,14 +400,13 @@
 	return get_dma_residue(hwif->hw.dma) != 0;
 }
 
-static int icside_dma_begin(ide_drive_t *drive)
+static void icside_dma_start(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 
 	/* We can not enable DMA on both channels simultaneously. */
 	BUG_ON(dma_channel_active(hwif->hw.dma));
 	enable_dma(hwif->hw.dma);
-	return 0;
 }
 
 /*
@@ -441,11 +438,16 @@
 	return DRIVER(drive)->error(drive, __FUNCTION__, stat);
 }
 
-static int
-icside_dma_common(ide_drive_t *drive, struct request *rq,
-		  unsigned int dma_mode)
+static int icside_dma_setup(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
+	struct request *rq = hwif->hwgroup->rq;
+	unsigned int dma_mode;
+
+	if (rq_data_dir(rq))
+		dma_mode = DMA_MODE_WRITE;
+	else
+		dma_mode = DMA_MODE_READ;
 
 	/*
 	 * We can not enable DMA on both channels.
@@ -481,79 +483,10 @@
 	return 0;
 }
 
-static int icside_dma_read(ide_drive_t *drive)
+static void icside_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
-	struct request *rq = HWGROUP(drive)->rq;
-	task_ioreg_t cmd;
-
-	if (icside_dma_common(drive, rq, DMA_MODE_READ))
-		return 1;
-
-	if (drive->media != ide_disk)
-		return 0;
-
-	BUG_ON(HWGROUP(drive)->handler != NULL);
-
-	/*
-	 * FIX ME to use only ACB ide_task_t args Struct
-	 */
-#if 0
-	{
-		ide_task_t *args = rq->special;
-		cmd = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-#else
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
-		cmd = args->tfRegister[IDE_COMMAND_OFFSET];
-	} else if (drive->addressing == 1) {
-		cmd = WIN_READDMA_EXT;
-	} else {
-		cmd = WIN_READDMA;
-	}
-#endif
 	/* issue cmd to drive */
 	ide_execute_command(drive, cmd, icside_dmaintr, 2*WAIT_CMD, NULL);
-
-	return icside_dma_begin(drive);
-}
-
-static int icside_dma_write(ide_drive_t *drive)
-{
-	struct request *rq = HWGROUP(drive)->rq;
-	task_ioreg_t cmd;
-
-	if (icside_dma_common(drive, rq, DMA_MODE_WRITE))
-		return 1;
-
-	if (drive->media != ide_disk)
-		return 0;
-
-	BUG_ON(HWGROUP(drive)->handler != NULL);
-
-	/*
-	 * FIX ME to use only ACB ide_task_t args Struct
-	 */
-#if 0
-	{
-		ide_task_t *args = rq->special;
-		cmd = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-#else
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
-		cmd = args->tfRegister[IDE_COMMAND_OFFSET];
-	} else if (drive->addressing == 1) {
-		cmd = WIN_WRITEDMA_EXT;
-	} else {
-		cmd = WIN_WRITEDMA;
-	}
-#endif
-
-	/* issue cmd to drive */
-	ide_execute_command(drive, cmd, icside_dmaintr, 2*WAIT_CMD, NULL);
-
-	return icside_dma_begin(drive);
 }
 
 static int icside_dma_test_irq(ide_drive_t *drive)
@@ -623,9 +556,9 @@
 	hwif->ide_dma_off_quietly = icside_dma_off_quietly;
 	hwif->ide_dma_host_on	= icside_dma_host_on;
 	hwif->ide_dma_on	= icside_dma_on;
-	hwif->ide_dma_read	= icside_dma_read;
-	hwif->ide_dma_write	= icside_dma_write;
-	hwif->ide_dma_begin	= icside_dma_begin;
+	hwif->dma_setup		= icside_dma_setup;
+	hwif->dma_exec_cmd	= icside_dma_exec_cmd;
+	hwif->dma_start		= icside_dma_start;
 	hwif->ide_dma_end	= icside_dma_end;
 	hwif->ide_dma_test_irq	= icside_dma_test_irq;
 	hwif->ide_dma_verbose	= icside_dma_verbose;
diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/ide-cd.c	2004-10-19 22:11:26 +02:00
@@ -865,20 +865,14 @@
 {
 	ide_startstop_t startstop;
 	struct cdrom_info *info = drive->driver_data;
+	ide_hwif_t *hwif = drive->hwif;
 
 	/* Wait for the controller to be idle. */
 	if (ide_wait_stat(&startstop, drive, 0, BUSY_STAT, WAIT_READY))
 		return startstop;
 
-	if (info->dma) {
-		if (info->cmd == READ) {
-			info->dma = !HWIF(drive)->ide_dma_read(drive);
-		} else if (info->cmd == WRITE) {
-			info->dma = !HWIF(drive)->ide_dma_write(drive);
-		} else {
-			printk("ide-cd: DMA set, but not allowed\n");
-		}
-	}
+	if (info->dma)
+		info->dma = !hwif->dma_setup(drive);
 
 	/* Set up the controller registers. */
 	/* FIXME: for Virtual DMA we must check harder */
@@ -916,6 +910,7 @@
 					  struct request *rq,
 					  ide_handler_t *handler)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	int cmd_len;
 	struct cdrom_info *info = drive->driver_data;
 	ide_startstop_t startstop;
@@ -947,7 +942,7 @@
 
 	/* Start the DMA if need be */
 	if (info->dma)
-		(void) HWIF(drive)->ide_dma_begin(drive);
+		hwif->dma_start(drive);
 
 	return ide_started;
 }
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/ide-disk.c	2004-10-19 22:11:26 +02:00
@@ -419,10 +419,25 @@
 		hwif->OUTB(head|drive->select.all,IDE_SELECT_REG);
 	}
 
-	if (rq_data_dir(rq) == READ) {
-		if (dma && !hwif->ide_dma_read(drive))
+	if (dma) {
+		if (!hwif->dma_setup(drive)) {
+			if (rq_data_dir(rq)) {
+				command = lba48 ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
+				if (drive->vdma)
+					command = lba48 ? WIN_WRITE_EXT: WIN_WRITE;
+			} else {
+				command = lba48 ? WIN_READDMA_EXT : WIN_READDMA;
+				if (drive->vdma)
+					command = lba48 ? WIN_READ_EXT: WIN_READ;
+			}
+			hwif->dma_exec_cmd(drive, command);
+			hwif->dma_start(drive);
 			return ide_started;
+		}
+		/* fallback to PIO */
+	}
 
+	if (rq_data_dir(rq) == READ) {
 		command = ((drive->mult_count) ?
 			   ((lba48) ? WIN_MULTREAD_EXT : WIN_MULTREAD) :
 			   ((lba48) ? WIN_READ_EXT : WIN_READ));
@@ -430,9 +445,6 @@
 		return ide_started;
 	} else {
 		ide_startstop_t startstop;
-
-		if (dma && !hwif->ide_dma_write(drive))
-			return ide_started;
 
 		command = ((drive->mult_count) ?
 			   ((lba48) ? WIN_MULTWRITE_EXT : WIN_MULTWRITE) :
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/ide-dma.c	2004-10-19 22:11:26 +02:00
@@ -85,6 +85,7 @@
 #include <linux/init.h>
 #include <linux/ide.h>
 #include <linux/delay.h>
+#include <linux/scatterlist.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -253,18 +254,12 @@
 #else
 	while (sector_count > 128) {
 #endif
-		memset(&sg[nents], 0, sizeof(*sg));
-		sg[nents].page = virt_to_page(virt_addr);
-		sg[nents].offset = offset_in_page(virt_addr);
-		sg[nents].length = 128  * SECTOR_SIZE;
+		sg_init_one(&sg[nents], virt_addr, 128 * SECTOR_SIZE);
 		nents++;
 		virt_addr = virt_addr + (128 * SECTOR_SIZE);
 		sector_count -= 128;
 	}
-	memset(&sg[nents], 0, sizeof(*sg));
-	sg[nents].page = virt_to_page(virt_addr);
-	sg[nents].offset = offset_in_page(virt_addr);
-	sg[nents].length =  sector_count  * SECTOR_SIZE;
+	sg_init_one(&sg[nents], virt_addr, sector_count * SECTOR_SIZE);
 	nents++;
 
 	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
@@ -590,10 +585,8 @@
 EXPORT_SYMBOL(__ide_dma_check);
 
 /**
- *	ide_start_dma	-	begin a DMA phase
- *	@hwif: interface
+ *	ide_dma_setup	-	begin a DMA phase
  *	@drive: target device
- *	@reading: set if reading, clear if writing
  *
  *	Build an IDE DMA PRD (IDE speak for scatter gather table)
  *	and then set up the DMA transfer registers for a device
@@ -603,12 +596,19 @@
  *	Returns 0 on success. If a PIO fallback is required then 1
  *	is returned. 
  */
- 
-int ide_start_dma(ide_hwif_t *hwif, ide_drive_t *drive, int reading)
+
+int ide_dma_setup(ide_drive_t *drive)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	struct request *rq = HWGROUP(drive)->rq;
+	unsigned int reading;
 	u8 dma_stat;
 
+	if (rq_data_dir(rq))
+		reading = 0;
+	else
+		reading = 1 << 3;
+
 	/* fall back to pio! */
 	if (!ide_build_dmatable(drive, rq))
 		return 1;
@@ -628,73 +628,15 @@
 	return 0;
 }
 
-EXPORT_SYMBOL(ide_start_dma);
-
-int __ide_dma_read (ide_drive_t *drive /*, struct request *rq */)
-{
-	ide_hwif_t *hwif	= HWIF(drive);
-	struct request *rq	= HWGROUP(drive)->rq;
-	unsigned int reading	= 1 << 3;
-	u8 lba48		= (drive->addressing == 1) ? 1 : 0;
-	task_ioreg_t command	= WIN_NOP;
-
-	/* try pio */
-	if (ide_start_dma(hwif, drive, reading))
-		return 1;
-
-	if (drive->media != ide_disk)
-		return 0;
-
-	command = (lba48) ? WIN_READDMA_EXT : WIN_READDMA;
-	
-	if (drive->vdma)
-		command = (lba48) ? WIN_READ_EXT: WIN_READ;
-		
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
-		command = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-
-	/* issue cmd to drive */
-	ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD,
dma_timer_expiry);
-	return hwif->ide_dma_begin(drive);
-}
-
-EXPORT_SYMBOL(__ide_dma_read);
+EXPORT_SYMBOL_GPL(ide_dma_setup);
 
-int __ide_dma_write (ide_drive_t *drive /*, struct request *rq */)
+static void ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
-	ide_hwif_t *hwif	= HWIF(drive);
-	struct request *rq	= HWGROUP(drive)->rq;
-	unsigned int reading	= 0;
-	u8 lba48		= (drive->addressing == 1) ? 1 : 0;
-	task_ioreg_t command	= WIN_NOP;
-
-	/* try PIO instead of DMA */
-	if (ide_start_dma(hwif, drive, reading))
-		return 1;
-
-	if (drive->media != ide_disk)
-		return 0;
-
-	command = (lba48) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
-	if (drive->vdma)
-		command = (lba48) ? WIN_WRITE_EXT: WIN_WRITE;
-		
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
-		command = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-
 	/* issue cmd to drive */
 	ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD,
dma_timer_expiry);
-
-	return hwif->ide_dma_begin(drive);
 }
 
-EXPORT_SYMBOL(__ide_dma_write);
-
-int __ide_dma_begin (ide_drive_t *drive)
+void ide_dma_start(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
 	u8 dma_cmd		= hwif->INB(hwif->dma_command);
@@ -708,10 +650,9 @@
 	hwif->OUTB(dma_cmd|1, hwif->dma_command);
 	hwif->dma = 1;
 	wmb();
-	return 0;
 }
 
-EXPORT_SYMBOL(__ide_dma_begin);
+EXPORT_SYMBOL_GPL(ide_dma_start);
 
 /* returns 1 on error, 0 otherwise */
 int __ide_dma_end (ide_drive_t *drive)
@@ -1009,12 +950,12 @@
 		hwif->ide_dma_host_on = &__ide_dma_host_on;
 	if (!hwif->ide_dma_check)
 		hwif->ide_dma_check = &__ide_dma_check;
-	if (!hwif->ide_dma_read)
-		hwif->ide_dma_read = &__ide_dma_read;
-	if (!hwif->ide_dma_write)
-		hwif->ide_dma_write = &__ide_dma_write;
-	if (!hwif->ide_dma_begin)
-		hwif->ide_dma_begin = &__ide_dma_begin;
+	if (!hwif->dma_setup)
+		hwif->dma_setup = &ide_dma_setup;
+	if (!hwif->dma_exec_cmd)
+		hwif->dma_exec_cmd = &ide_dma_exec_cmd;
+	if (!hwif->dma_start)
+		hwif->dma_start = &ide_dma_start;
 	if (!hwif->ide_dma_end)
 		hwif->ide_dma_end = &__ide_dma_end;
 	if (!hwif->ide_dma_test_irq)
diff -Nru a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
--- a/drivers/ide/ide-floppy.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/ide-floppy.c	2004-10-19 22:11:26 +02:00
@@ -995,6 +995,7 @@
 static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive,
idefloppy_pc_t *pc)
 {
 	idefloppy_floppy_t *floppy = drive->driver_data;
+	ide_hwif_t *hwif = drive->hwif;
 	atapi_feature_t feature;
 	atapi_bcount_t bcount;
 	ide_handler_t *pkt_xfer_routine;
@@ -1049,13 +1050,8 @@
 	}
 	feature.all = 0;
 
-	if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
-		if (test_bit(PC_WRITING, &pc->flags)) {
-			feature.b.dma = !HWIF(drive)->ide_dma_write(drive);
-		} else {
-			feature.b.dma = !HWIF(drive)->ide_dma_read(drive);
-		}
-	}
+	if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
+		feature.b.dma = !hwif->dma_setup(drive);
 
 	if (IDE_CONTROL_REG)
 		HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
@@ -1067,7 +1063,7 @@
 
 	if (feature.b.dma) {	/* Begin DMA, if necessary */
 		set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
-		(void) (HWIF(drive)->ide_dma_begin(drive));
+		hwif->dma_start(drive);
 	}
 
 	/* Can we transfer the packet when we get the interrupt or wait? */
diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- a/drivers/ide/ide-tape.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/ide-tape.c	2004-10-19 22:11:26 +02:00
@@ -2067,7 +2067,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	/* Begin DMA, if necessary */
 	if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags))
-		(void) (HWIF(drive)->ide_dma_begin(drive));
+		hwif->dma_start(drive);
 #endif
 	/* Send the actual packet */
 	HWIF(drive)->atapi_output_bytes(drive, pc->c, 12);
@@ -2135,12 +2135,8 @@
 				"reverting to PIO\n");
 		(void)__ide_dma_off(drive);
 	}
-	if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
-		if (test_bit(PC_WRITING, &pc->flags))
-			dma_ok = !HWIF(drive)->ide_dma_write(drive);
-		else
-			dma_ok = !HWIF(drive)->ide_dma_read(drive);
-	}
+	if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
+		dma_ok = !hwif->dma_setup(drive);
 
 	if (IDE_CONTROL_REG)
 		hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
diff -Nru a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
--- a/drivers/ide/ide-taskfile.c	2004-10-19 22:11:25 +02:00
+++ b/drivers/ide/ide-taskfile.c	2004-10-19 22:11:25 +02:00
@@ -150,15 +150,15 @@
 		case WIN_WRITEDMA_ONCE:
 		case WIN_WRITEDMA:
 		case WIN_WRITEDMA_EXT:
-			if (!hwif->ide_dma_write(drive))
-				return ide_started;
-			break;
 		case WIN_READDMA_ONCE:
 		case WIN_READDMA:
 		case WIN_READDMA_EXT:
 		case WIN_IDENTIFY_DMA:
-			if (!hwif->ide_dma_read(drive))
+			if (!hwif->dma_setup(drive)) {
+				hwif->dma_exec_cmd(drive, taskfile->command);
+				hwif->dma_start(drive);
 				return ide_started;
+			}
 			break;
 		default:
 			if (task->handler == NULL)
@@ -517,6 +517,9 @@
 
 		rq.hard_nr_sectors = rq.nr_sectors;
 		rq.hard_cur_sectors = rq.current_nr_sectors = rq.nr_sectors;
+
+		if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
+			rq.flags |= REQ_RW;
 	}
 
 	rq.special = args;
@@ -896,12 +899,11 @@
 
    	        case TASKFILE_OUT_DMAQ:
 		case TASKFILE_OUT_DMA:
-			hwif->ide_dma_write(drive);
-			break;
-
 		case TASKFILE_IN_DMAQ:
 		case TASKFILE_IN_DMA:
-			hwif->ide_dma_read(drive);
+			hwif->dma_setup(drive);
+			hwif->dma_exec_cmd(drive, taskfile->command);
+			hwif->dma_start(drive);
 			break;
 
 	        default:
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/ide.c	2004-10-19 22:11:26 +02:00
@@ -685,9 +685,9 @@
 	hwif->atapi_input_bytes		= tmp_hwif->atapi_input_bytes;
 	hwif->atapi_output_bytes	= tmp_hwif->atapi_output_bytes;
 
-	hwif->ide_dma_read		= tmp_hwif->ide_dma_read;
-	hwif->ide_dma_write		= tmp_hwif->ide_dma_write;
-	hwif->ide_dma_begin		= tmp_hwif->ide_dma_begin;
+	hwif->dma_setup			= tmp_hwif->dma_setup;
+	hwif->dma_exec_cmd		= tmp_hwif->dma_exec_cmd;
+	hwif->dma_start			= tmp_hwif->dma_start;
 	hwif->ide_dma_end		= tmp_hwif->ide_dma_end;
 	hwif->ide_dma_check		= tmp_hwif->ide_dma_check;
 	hwif->ide_dma_on		= tmp_hwif->ide_dma_on;
diff -Nru a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
--- a/drivers/ide/pci/alim15x3.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/pci/alim15x3.c	2004-10-19 22:11:26 +02:00
@@ -558,18 +558,19 @@
 }
 
 /**
- *	ali15x3_dma_write	-	do a DMA IDE write
- *	@drive:	drive to issue write for
+ *	ali15x3_dma_setup	-	begin a DMA phase
+ *	@drive:	target device
  *
- *	Returns 1 if the DMA write cannot be performed, zero on 
- *	success.
+ *	Returns 1 if the DMA cannot be performed, zero on success.
  */
- 
-static int ali15x3_dma_write (ide_drive_t *drive)
+
+static int ali15x3_dma_setup(ide_drive_t *drive)
 {
-	if ((m5229_revision < 0xC2) && (drive->media != ide_disk))
-		return 1;	/* try PIO instead of DMA */
-	return __ide_dma_write(drive);
+	if (m5229_revision < 0xC2 && drive->media != ide_disk) {
+		if (rq_data_dir(drive->hwif->hwgroup->rq))
+			return 1;	/* try PIO instead of DMA */
+	}
+	return ide_dma_setup(drive);
 }
 
 /**
@@ -773,7 +774,7 @@
                  * M1543C or newer for DMAing
                  */
                 hwif->ide_dma_check = &ali15x3_config_drive_for_dma;
-                hwif->ide_dma_write = &ali15x3_dma_write;
+		hwif->dma_setup = &ali15x3_dma_setup;
 		if (!noautodma)
 			hwif->autodma = 1;
 		if (!(hwif->udma_four))
diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
--- a/drivers/ide/pci/hpt366.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/pci/hpt366.c	2004-10-19 22:11:26 +02:00
@@ -577,7 +577,7 @@
 	/* how about we flush and reset, mmmkay? */
 	pci_write_config_byte(dev, 0x51, 0x1F);
 	/* fall through to a reset */
-	case ide_dma_begin:
+	case dma_start:
 	case ide_dma_end:
 	/* reset the chips state over and over.. */
 	pci_write_config_byte(dev, 0x51, 0x13);
@@ -592,12 +592,12 @@
 	udelay(10);
 }
 
-static int hpt370_ide_dma_begin (ide_drive_t *drive)
+static void hpt370_ide_dma_start(ide_drive_t *drive)
 {
 #ifdef HPT_RESET_STATE_ENGINE
 	hpt370_clear_engine(drive);
 #endif
-	return __ide_dma_begin(drive);
+	ide_dma_start(drive);
 }
 
 static int hpt370_ide_dma_end (ide_drive_t *drive)
@@ -1230,7 +1230,7 @@
 		hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq;
 		hwif->ide_dma_end = &hpt374_ide_dma_end;
 	} else if (hpt_minimum_revision(dev,3)) {
-		hwif->ide_dma_begin = &hpt370_ide_dma_begin;
+		hwif->dma_start = &hpt370_ide_dma_start;
 		hwif->ide_dma_end = &hpt370_ide_dma_end;
 		hwif->ide_dma_timeout = &hpt370_ide_dma_timeout;
 		hwif->ide_dma_lostirq = &hpt370_ide_dma_lostirq;
diff -Nru a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
--- a/drivers/ide/pci/ns87415.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/pci/ns87415.c	2004-10-19 22:11:26 +02:00
@@ -101,22 +101,11 @@
 	return (dma_stat & 7) != 4;
 }
 
-static int ns87415_ide_dma_read (ide_drive_t *drive)
+static int ns87415_ide_dma_setup(ide_drive_t *drive)
 {
 	/* select DMA xfer */
 	ns87415_prepare_drive(drive, 1);
-	if (!(__ide_dma_read(drive)))
-		return 0;
-	/* DMA failed: select PIO xfer */
-	ns87415_prepare_drive(drive, 0);
-	return 1;
-}
-
-static int ns87415_ide_dma_write (ide_drive_t *drive)
-{
-	/* select DMA xfer */
-	ns87415_prepare_drive(drive, 1);
-	if (!(__ide_dma_write(drive)))
+	if (!ide_dma_setup(drive))
 		return 0;
 	/* DMA failed: select PIO xfer */
 	ns87415_prepare_drive(drive, 0);
@@ -204,8 +193,7 @@
 		return;
 
 	hwif->OUTB(0x60, hwif->dma_status);
-	hwif->ide_dma_read = &ns87415_ide_dma_read;
-	hwif->ide_dma_write = &ns87415_ide_dma_write;
+	hwif->dma_setup = &ns87415_ide_dma_setup;
 	hwif->ide_dma_check = &ns87415_ide_dma_check;
 	hwif->ide_dma_end = &ns87415_ide_dma_end;
 
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/pci/pdc202xx_old.c	2004-10-19 22:11:26 +02:00
@@ -494,7 +494,7 @@
 	return ((int) check_in_drive_lists(drive, pdc_quirk_drives));
 }
 
-static int pdc202xx_old_ide_dma_begin(ide_drive_t *drive)
+static void pdc202xx_old_ide_dma_start(ide_drive_t *drive)
 {
 	if (drive->current_speed > XFER_UDMA_2)
 		pdc_old_enable_66MHz_clock(drive->hwif);
@@ -515,7 +515,7 @@
 					word_count | 0x06000000;
 		hwif->OUTL(word_count, atapi_reg);
 	}
-	return __ide_dma_begin(drive);
+	ide_dma_start(drive);
 }
 
 static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
@@ -736,7 +736,7 @@
 	if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) {
 		if (!(hwif->udma_four))
 			hwif->udma_four = (pdc202xx_old_cable_detect(hwif)) ? 0 : 1;
-		hwif->ide_dma_begin = &pdc202xx_old_ide_dma_begin;
+		hwif->dma_start = &pdc202xx_old_ide_dma_start;
 		hwif->ide_dma_end = &pdc202xx_old_ide_dma_end;
 	} 
 	hwif->ide_dma_test_irq = &pdc202xx_old_ide_dma_test_irq;
diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
--- a/drivers/ide/pci/sgiioc4.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/pci/sgiioc4.c	2004-10-19 22:11:26 +02:00
@@ -192,16 +192,13 @@
 	return intr_reg & 3;
 }
 
-static int
-sgiioc4_ide_dma_begin(ide_drive_t * drive)
+static void sgiioc4_ide_dma_start(ide_drive_t * drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	unsigned int reg = hwif->INL(hwif->dma_base + IOC4_DMA_CTRL * 4);
 	unsigned int temp_reg = reg | IOC4_S_DMA_START;
 
 	hwif->OUTL(temp_reg, hwif->dma_base + IOC4_DMA_CTRL * 4);
-
-	return 0;
 }
 
 static u32
@@ -574,35 +571,30 @@
 	return 0;		/* revert to PIO for this request */
 }
 
-static int
-sgiioc4_ide_dma_read(ide_drive_t * drive)
+static int sgiioc4_ide_dma_setup(ide_drive_t *drive)
 {
 	struct request *rq = HWGROUP(drive)->rq;
 	unsigned int count = 0;
+	int ddir;
 
-	if (!(count = sgiioc4_build_dma_table(drive, rq, PCI_DMA_FROMDEVICE))) {
-		/* try PIO instead of DMA */
-		return 1;
-	}
-	/* Writes FROM the IOC4 TO Main Memory */
-	sgiioc4_configure_for_dma(IOC4_DMA_WRITE, drive);
-
-	return 0;
-}
-
-static int
-sgiioc4_ide_dma_write(ide_drive_t * drive)
-{
-	struct request *rq = HWGROUP(drive)->rq;
-	unsigned int count = 0;
+	if (rq_data_dir(rq))
+		ddir = PCI_DMA_TODEVICE;
+	else
+		ddir = PCI_DMA_FROMDEVICE;
 
-	if (!(count = sgiioc4_build_dma_table(drive, rq, PCI_DMA_TODEVICE))) {
+	if (!(count = sgiioc4_build_dma_table(drive, rq, ddir))) {
 		/* try PIO instead of DMA */
 		return 1;
 	}
 
-	sgiioc4_configure_for_dma(IOC4_DMA_READ, drive);
-	/* Writes TO the IOC4 FROM Main Memory */
+	if (rq_data_dir(rq))
+		/* Writes TO the IOC4 FROM Main Memory */
+		ddir = IOC4_DMA_READ;
+	else
+		/* Writes FROM the IOC4 TO Main Memory */
+		ddir = IOC4_DMA_WRITE;
+
+	sgiioc4_configure_for_dma(ddir, drive);
 
 	return 0;
 }
@@ -629,9 +621,8 @@
 	hwif->quirkproc = NULL;
 	hwif->busproc = NULL;
 
-	hwif->ide_dma_read = &sgiioc4_ide_dma_read;
-	hwif->ide_dma_write = &sgiioc4_ide_dma_write;
-	hwif->ide_dma_begin = &sgiioc4_ide_dma_begin;
+	hwif->dma_setup = &sgiioc4_ide_dma_setup;
+	hwif->dma_start = &sgiioc4_ide_dma_start;
 	hwif->ide_dma_end = &sgiioc4_ide_dma_end;
 	hwif->ide_dma_check = &sgiioc4_ide_dma_check;
 	hwif->ide_dma_on = &sgiioc4_ide_dma_on;
diff -Nru a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
--- a/drivers/ide/pci/sl82c105.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/ide/pci/sl82c105.c	2004-10-19 22:11:26 +02:00
@@ -236,15 +236,13 @@
  * The generic IDE core will have disabled the BMEN bit before this
  * function is called.
  */
-static int sl82c105_ide_dma_begin(ide_drive_t *drive)
+static void sl82c105_ide_dma_start(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	struct pci_dev *dev = hwif->pci_dev;
 
-//	DBG(("sl82c105_ide_dma_begin(drive:%s)\n", drive->name));
-
 	sl82c105_reset_host(dev);
-	return __ide_dma_begin(drive);
+	ide_dma_start(drive);
 }
 
 static int sl82c105_ide_dma_timeout(ide_drive_t *drive)
@@ -469,7 +467,7 @@
 	hwif->ide_dma_on = &sl82c105_ide_dma_on;
 	hwif->ide_dma_off_quietly = &sl82c105_ide_dma_off_quietly;
 	hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq;
-	hwif->ide_dma_begin = &sl82c105_ide_dma_begin;
+	hwif->dma_start = &sl82c105_ide_dma_start;
 	hwif->ide_dma_timeout = &sl82c105_ide_dma_timeout;
 
 	if (!noautodma)
diff -Nru a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
--- a/drivers/ide/pci/trm290.c	2004-10-19 22:11:25 +02:00
+++ b/drivers/ide/pci/trm290.c	2004-10-19 22:11:25 +02:00
@@ -179,64 +179,32 @@
 }
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-static int trm290_ide_dma_write (ide_drive_t *drive /*, struct request *rq */)
+static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
-	struct request *rq	= HWGROUP(drive)->rq;
-//	ide_task_t *args	= rq->special;
-	task_ioreg_t command	= WIN_NOP;
-	unsigned int count, reading = 2, writing = 0;
 
-	reading = 0;
-	writing = 1;
-#ifdef TRM290_NO_DMA_WRITES
-	/* always use PIO for writes */
-	trm290_prepare_drive(drive, 0);	/* select PIO xfer */
-	return 1;
-#endif
-	if (!(count = ide_build_dmatable(drive, rq))) {
-		/* try PIO instead of DMA */
-		trm290_prepare_drive(drive, 0); /* select PIO xfer */
-		return 1;
-	}
-	/* select DMA xfer */
-	trm290_prepare_drive(drive, 1);
-	hwif->OUTL(hwif->dmatable_dma|reading|writing, hwif->dma_command);
-	drive->waiting_for_dma = 1;
-	/* start DMA */
-	hwif->OUTW((count * 2) - 1, hwif->dma_status);
-	if (drive->media != ide_disk)
-		return 0;
 	if (HWGROUP(drive)->handler != NULL)	/* paranoia check */
 		BUG();
 	ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
-	/*
-	 * FIX ME to use only ACB ide_task_t args Struct
-	 */
-#if 0
-	{
-		ide_task_t *args = rq->special;
-		command = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-#else
-	command = /* (lba48) ? WIN_READDMA_EXT : */ WIN_READDMA;
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
-		command = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-#endif
 	/* issue cmd to drive */
 	hwif->OUTB(command, IDE_COMMAND_REG);
-	return hwif->ide_dma_begin(drive);
 }
 
-static int trm290_ide_dma_read (ide_drive_t *drive  /*, struct request *rq */)
+static int trm290_ide_dma_setup(ide_drive_t *drive)
 {
-	ide_hwif_t *hwif	= HWIF(drive);
-	struct request *rq	= HWGROUP(drive)->rq;
-//	ide_task_t *args	= rq->special;
-	task_ioreg_t command	= WIN_NOP;
-	unsigned int count, reading = 2, writing = 0;
+	ide_hwif_t *hwif = drive->hwif;
+	struct request *rq = hwif->hwgroup->rq;
+	unsigned int count, rw;
+
+	if (rq_data_dir(rq)) {
+#ifdef TRM290_NO_DMA_WRITES
+		/* always use PIO for writes */
+		trm290_prepare_drive(drive, 0);	/* select PIO xfer */
+		return 1;
+#endif
+		rw = 1;
+	} else
+		rw = 2;
 
 	if (!(count = ide_build_dmatable(drive, rq))) {
 		/* try PIO instead of DMA */
@@ -245,38 +213,15 @@
 	}
 	/* select DMA xfer */
 	trm290_prepare_drive(drive, 1);
-	hwif->OUTL(hwif->dmatable_dma|reading|writing, hwif->dma_command);
+	hwif->OUTL(hwif->dmatable_dma|rw, hwif->dma_command);
 	drive->waiting_for_dma = 1;
 	/* start DMA */
 	hwif->OUTW((count * 2) - 1, hwif->dma_status);
-	if (drive->media != ide_disk)
-		return 0;
-	if (HWGROUP(drive)->handler != NULL)	/* paranoia check */
-		BUG();
-	ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
-	/*
-	 * FIX ME to use only ACB ide_task_t args Struct
-	 */
-#if 0
-	{
-		ide_task_t *args = rq->special;
-		command = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-#else
-	command = /* (lba48) ? WIN_WRITEDMA_EXT : */ WIN_WRITEDMA;
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
-		command = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-#endif
-	/* issue cmd to drive */
-	hwif->OUTB(command, IDE_COMMAND_REG);
-	return hwif->ide_dma_begin(drive);
+	return 0;
 }
 
-static int trm290_ide_dma_begin (ide_drive_t *drive)
+static void trm290_ide_dma_start(ide_drive_t *drive)
 {
-	return 0;
 }
 
 static int trm290_ide_dma_end (ide_drive_t *drive)
@@ -347,9 +292,9 @@
 	ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ?
0x0080 : 0x0000), 3);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-	hwif->ide_dma_write = &trm290_ide_dma_write;
-	hwif->ide_dma_read = &trm290_ide_dma_read;
-	hwif->ide_dma_begin = &trm290_ide_dma_begin;
+	hwif->dma_setup = &trm290_ide_dma_setup;
+	hwif->dma_exec_cmd = &trm290_ide_dma_exec_cmd;
+	hwif->dma_start = &trm290_ide_dma_start;
 	hwif->ide_dma_end = &trm290_ide_dma_end;
 	hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;
 #endif /* CONFIG_BLK_DEV_IDEDMA */
diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
--- a/drivers/ide/ppc/pmac.c	2004-10-19 22:11:25 +02:00
+++ b/drivers/ide/ppc/pmac.c	2004-10-19 22:11:25 +02:00
@@ -34,6 +34,7 @@
 #include <linux/pci.h>
 #include <linux/adb.h>
 #include <linux/pmu.h>
+#include <linux/scatterlist.h>
 
 #include <asm/prom.h>
 #include <asm/io.h>
@@ -361,7 +362,6 @@
 static void pmac_ide_tuneproc(ide_drive_t *drive, u8 pio);
 static void pmac_ide_selectproc(ide_drive_t *drive);
 static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
-static int pmac_ide_dma_begin (ide_drive_t *drive);
 
 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
 
@@ -1604,18 +1604,12 @@
 		pmif->sg_dma_direction = PCI_DMA_FROMDEVICE;
 	
 	if (sector_count > 128) {
-		memset(&sg[nents], 0, sizeof(*sg));
-		sg[nents].page = virt_to_page(virt_addr);
-		sg[nents].offset = offset_in_page(virt_addr);
-		sg[nents].length = 128  * SECTOR_SIZE;
+		sg_init_one(&sg[nents], virt_addr, 128 * SECTOR_SIZE);
 		nents++;
 		virt_addr = virt_addr + (128 * SECTOR_SIZE);
 		sector_count -= 128;
 	}
-	memset(&sg[nents], 0, sizeof(*sg));
-	sg[nents].page = virt_to_page(virt_addr);
-	sg[nents].offset = offset_in_page(virt_addr);
-	sg[nents].length =  sector_count  * SECTOR_SIZE;
+	sg_init_one(&sg[nents], virt_addr, sector_count * SECTOR_SIZE);
 	nents++;
    
 	return pci_map_sg(hwif->pci_dev, sg, nents, pmif->sg_dma_direction);
@@ -1885,7 +1879,7 @@
  * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion
  */
 static int __pmac
-pmac_ide_dma_start(ide_drive_t *drive, int reading)
+pmac_ide_dma_setup(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
@@ -1902,7 +1896,7 @@
 
 	/* Apple adds 60ns to wrDataSetup on reads */
 	if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
-		writel(pmif->timings[unit] + (reading ? 0x00800000UL : 0),
+		writel(pmif->timings[unit] + (!rq_data_dir(rq) ? 0x00800000UL : 0),
 			PMAC_IDE_REG(IDE_TIMING_CONFIG));
 		(void)readl(PMAC_IDE_REG(IDE_TIMING_CONFIG));
 	}
@@ -1912,87 +1906,28 @@
 	return 0;
 }
 
-/*
- * Start a DMA READ command
- */
-static int __pmac
-pmac_ide_dma_read(ide_drive_t *drive)
-{
-	struct request *rq = HWGROUP(drive)->rq;
-	u8 lba48 = (drive->addressing == 1) ? 1 : 0;
-	task_ioreg_t command = WIN_NOP;
-
-	if (pmac_ide_dma_start(drive, 1))
-		return 1;
-
-	if (drive->media != ide_disk)
-		return 0;
-
-	command = (lba48) ? WIN_READDMA_EXT : WIN_READDMA;
-	
-	if (drive->vdma)
-		command = (lba48) ? WIN_READ_EXT: WIN_READ;
-		
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
-		command = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-
-	/* issue cmd to drive */
-	ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, NULL);
-
-	return pmac_ide_dma_begin(drive);
-}
-
-/*
- * Start a DMA WRITE command
- */
-static int __pmac
-pmac_ide_dma_write (ide_drive_t *drive)
+static void __pmac
+pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
-	struct request *rq = HWGROUP(drive)->rq;
-	u8 lba48 = (drive->addressing == 1) ? 1 : 0;
-	task_ioreg_t command = WIN_NOP;
-
-	if (pmac_ide_dma_start(drive, 0))
-		return 1;
-
-	if (drive->media != ide_disk)
-		return 0;
-
-	command = (lba48) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
-	if (drive->vdma)
-		command = (lba48) ? WIN_WRITE_EXT: WIN_WRITE;
-		
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = rq->special;
-		command = args->tfRegister[IDE_COMMAND_OFFSET];
-	}
-
 	/* issue cmd to drive */
 	ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, NULL);
-
-	return pmac_ide_dma_begin(drive);
 }
 
 /*
  * Kick the DMA controller into life after the DMA command has been issued
  * to the drive.
  */
-static int __pmac
-pmac_ide_dma_begin (ide_drive_t *drive)
+static void __pmac
+pmac_ide_dma_start(ide_drive_t *drive)
 {
 	pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
 	volatile struct dbdma_regs __iomem *dma;
 
-	if (pmif == NULL)
-		return 1;
 	dma = pmif->dma_regs;
 
 	writel((RUN << 16) | RUN, &dma->control);
 	/* Make sure it gets to the controller right now */
 	(void)readl(&dma->control);
-	return 0;
 }
 
 /*
@@ -2148,9 +2083,9 @@
 	hwif->ide_dma_off_quietly = &__ide_dma_off_quietly;
 	hwif->ide_dma_on = &__ide_dma_on;
 	hwif->ide_dma_check = &pmac_ide_dma_check;
-	hwif->ide_dma_read = &pmac_ide_dma_read;
-	hwif->ide_dma_write = &pmac_ide_dma_write;
-	hwif->ide_dma_begin = &pmac_ide_dma_begin;
+	hwif->dma_setup = &pmac_ide_dma_setup;
+	hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd;
+	hwif->dma_start = &pmac_ide_dma_start;
 	hwif->ide_dma_end = &pmac_ide_dma_end;
 	hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq;
 	hwif->ide_dma_host_off = &pmac_ide_dma_host_off;
diff -Nru a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
--- a/drivers/scsi/ide-scsi.c	2004-10-19 22:11:26 +02:00
+++ b/drivers/scsi/ide-scsi.c	2004-10-19 22:11:26 +02:00
@@ -555,6 +555,7 @@
 
 static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	idescsi_scsi_t *scsi = drive_to_idescsi(drive);
 	idescsi_pc_t *pc = scsi->pc;
 	atapi_ireason_t ireason;
@@ -579,7 +580,7 @@
 	atapi_output_bytes(drive, scsi->pc->c, 12);
 	if (test_bit (PC_DMA_OK, &pc->flags)) {
 		set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
-		(void) (HWIF(drive)->ide_dma_begin(drive));
+		hwif->dma_start(drive);
 	}
 	return ide_started;
 }
@@ -590,6 +591,7 @@
 static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
 {
 	idescsi_scsi_t *scsi = drive_to_idescsi(drive);
+	ide_hwif_t *hwif = drive->hwif;
 	atapi_feature_t feature;
 	atapi_bcount_t bcount;
 	struct request *rq = pc->rq;
@@ -600,12 +602,8 @@
 	bcount.all = min(pc->request_transfer, 63 * 1024);		/* Request to
transfer the entire buffer at once */
 
 	feature.all = 0;
-	if (drive->using_dma && rq->bio) {
-		if (test_bit(PC_WRITING, &pc->flags))
-			feature.b.dma = !HWIF(drive)->ide_dma_write(drive);
-		else
-			feature.b.dma = !HWIF(drive)->ide_dma_read(drive);
-	}
+	if (drive->using_dma && rq->bio)
+		feature.b.dma = !hwif->dma_setup(drive);
 
 	SELECT_DRIVE(drive);
 	if (IDE_CONTROL_REG)
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2004-10-19 22:11:26 +02:00
+++ b/include/linux/ide.h	2004-10-19 22:11:26 +02:00
@@ -887,9 +887,9 @@
 	void (*atapi_input_bytes)(ide_drive_t *, void *, u32);
 	void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
 
-	int (*ide_dma_read)(ide_drive_t *drive);
-	int (*ide_dma_write)(ide_drive_t *drive);
-	int (*ide_dma_begin)(ide_drive_t *drive);
+	int (*dma_setup)(ide_drive_t *);
+	void (*dma_exec_cmd)(ide_drive_t *, u8);
+	void (*dma_start)(ide_drive_t *);
 	int (*ide_dma_end)(ide_drive_t *drive);
 	int (*ide_dma_check)(ide_drive_t *drive);
 	int (*ide_dma_on)(ide_drive_t *drive);
@@ -1544,16 +1544,14 @@
 extern ide_startstop_t ide_dma_intr(ide_drive_t *);
 extern int ide_release_dma(ide_hwif_t *);
 extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int);
-extern int ide_start_dma(ide_hwif_t *, ide_drive_t *, int);
 
 extern int __ide_dma_host_off(ide_drive_t *);
 extern int __ide_dma_off_quietly(ide_drive_t *);
 extern int __ide_dma_host_on(ide_drive_t *);
 extern int __ide_dma_on(ide_drive_t *);
 extern int __ide_dma_check(ide_drive_t *);
-extern int __ide_dma_read(ide_drive_t *);
-extern int __ide_dma_write(ide_drive_t *);
-extern int __ide_dma_begin(ide_drive_t *);
+extern int ide_dma_setup(ide_drive_t *);
+extern void ide_dma_start(ide_drive_t *);
 extern int __ide_dma_end(ide_drive_t *);
 extern int __ide_dma_test_irq(ide_drive_t *);
 extern int __ide_dma_verbose(ide_drive_t *);
diff -Nru a/include/linux/scatterlist.h b/include/linux/scatterlist.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/scatterlist.h	2004-10-19 22:11:26 +02:00
@@ -0,0 +1,14 @@
+#ifndef _LINUX_SCATTERLIST_H
+#define _LINUX_SCATTERLIST_H
+
+static inline void sg_init_one(struct scatterlist *sg,
+			       u8 *buf, unsigned int buflen)
+{
+	memset(sg, 0, sizeof(*sg));
+
+	sg->page = virt_to_page(buf);
+	sg->offset = offset_in_page(buf);
+	sg->length = buflen;
+}
+
+#endif /* _LINUX_SCATTERLIST_H */

^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2005-04-02 15:23 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-30 22:32 [BK PATCHES] ide-2.6 update Bartlomiej Zolnierkiewicz
  -- strict thread matches above, loose matches on Subject: below --
2005-04-02 15:22 Bartlomiej Zolnierkiewicz
2005-03-18 16:22 Bartlomiej Zolnierkiewicz
2005-03-10 17:45 Bartlomiej Zolnierkiewicz
2005-02-24 11:20 Bartlomiej Zolnierkiewicz
2005-02-20 14:24 Bartlomiej Zolnierkiewicz
2005-02-06 14:03 Bartlomiej Zolnierkiewicz
2005-02-03 16:47 Bartlomiej Zolnierkiewicz
2005-01-07  3:48 Bartlomiej Zolnierkiewicz
2004-12-10 19:40 Bartlomiej Zolnierkiewicz
2004-12-10 21:15 ` Bartlomiej Zolnierkiewicz
2004-12-14 18:23 ` Enrico Scholz
2004-11-17 23:41 Bartlomiej Zolnierkiewicz
2004-11-06  0:54 Bartlomiej Zolnierkiewicz
2004-11-01 18:26 Bartlomiej Zolnierkiewicz
2004-10-31  2:27 Kevin Freeman
2004-10-29 18:00 Bartlomiej Zolnierkiewicz
2004-10-27 16:10 Chuck Ebbert
2004-10-27 16:18 ` Alan Cox
2004-10-27 18:58   ` Gene Heskett
2004-10-28 20:19     ` Eric Mudama
2004-10-30 15:48       ` tabris
2004-10-27 16:29 ` Bartlomiej Zolnierkiewicz
2004-10-27 13:07 Bartlomiej Zolnierkiewicz
2004-10-27 13:34 ` CaT
2004-10-27 13:51   ` Bartlomiej Zolnierkiewicz
2004-10-27 14:33     ` Mikael Pettersson
2004-10-27 14:49       ` Bartlomiej Zolnierkiewicz
2004-10-27 14:29 ` J.A. Magallon
2004-10-27 15:07   ` Bartlomiej Zolnierkiewicz
2004-10-27 16:15 ` Gene Heskett
2004-10-27 16:22   ` Bartlomiej Zolnierkiewicz
2004-10-27 17:05     ` Gene Heskett
2004-10-27 17:02       ` Randy.Dunlap
2004-10-27 18:17         ` Gene Heskett
2004-10-27 17:15       ` Bartlomiej Zolnierkiewicz
2004-10-27 18:19         ` Gene Heskett
2004-10-27 17:20       ` Linus Torvalds
2004-10-27 18:26         ` Gene Heskett
2004-10-27 18:41           ` Linus Torvalds
2004-10-27 19:03             ` Gene Heskett
2004-10-28  6:45         ` Gene Heskett
2004-10-24 12:08 Bartlomiej Zolnierkiewicz
2004-10-24 19:48 ` James Cloos
2004-10-24 20:15   ` Bartlomiej Zolnierkiewicz
2004-10-24 20:51     ` James Cloos
2004-10-25 19:18     ` Bill Davidsen
2004-10-22 17:38 Bartlomiej Zolnierkiewicz
2004-10-22 18:07 ` Russell King
2004-10-22 18:17   ` Bartlomiej Zolnierkiewicz
2004-10-22  0:34 Bartlomiej Zolnierkiewicz
2004-10-20 17:42 Bartlomiej Zolnierkiewicz
2004-10-19 20:47 Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).