24 Jul, 2008

40 commits

  • There should be no functionality change resulting from this patch.

    [bart: s/HWGROUP(drive)/hwif->hwgroup/]

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • Make a redundant copy of the packet command bits into rq->cmd.
    Later, after all drivers have been converted, it'll be
    switched to use that in the common code instead of pc->c.

    There should be no functionality change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • Make a redundant copy of the packet command bits into rq->cmd. Later, after
    all drivers have been converted, it'll be switched to use that in the
    common code instead of pc->c. While at it, simplify ide_tape_create_rw_cmd.

    There should be no functionality change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • ide-tape uses rq->cmd for special commands from the chrdev interface so move
    those to byte 13 (BLK_MAX_CDB = 16) since a packet cmd is max 12 bytes.

    There should be no functionality change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • Make a redundant copy of the packet command bits into rq->cmd.
    Later, after all drivers have been converted, it'll be
    switched to use that in the common code instead of pc->c.

    There should be no functionality change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • There should be no functionality change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • There should be no functionality change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • The if-else block in the IRQ handler is only temporary so that bisect searches
    don't break and it'll be removed after converting the remainder of the drivers.

    There should be no functionality change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • It is important that drive->pc_callback is set prior to enabling IRQs on the
    device since this is called from the IRQ handler. Otherwise it hurts as I learnt
    the hard way from the several "Kernel panic - not synching: Fatal exception in
    interrupt" during the weekend :).

    The if-else block in the IRQ handler is only temporary so that bisect searches
    don't break and it'll be removed after converting the remainder of the drivers.

    There should be no functionality change resulting from this patch.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • Refrain from carrying the callback ptr with every packet command since the
    callback function is only one anyways. ide_drive_t is probably not the most
    suitable place for it right now but is the more sane solution. Besides, these
    structs are going to be reorganized anyways during the generic ide rewrite.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Borislav Petkov
     
  • Coverity CID: 2336 USE_AFTER_FREE

    drivers/ide/ide-tape.c ide_tape_kfree_buffer() double free's a pointer
    (hint freed by an alias in first outer loop).

    This patch simply removes the superfluous kfree().

    Signed-off-by: Darren Jenkins
    Acked-by: Borislav Petkov
    Cc: gadio@netvision.net.il
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Darren Jenkins
     
  • * Add ide_host_free() helper and convert ide_host_remove() to use it.

    * Fix handling of ide_host_register() failure in ide_host_add(),
    icside.c, ide-generic.c, falconide.c and sgiioc4.c.

    While at it:

    * Fix handling of ide_host_alloc_all() failure in ide-generic.c.

    * Fix handling of ide_host_alloc() failure in falconide.c
    (also return the correct error value if no device is found).

    v2:
    * falconide build fix. (From Stephen Rothwell)

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Allocate ide_hwif_t instances dynamically and remove ide_hwifs[].

    This cuts almost ~14kB from ide-probe.o (x86-32, MAX_HWIFS == 10):

    text data bss dec hex filename
    9140 40 14084 23264 5ae0 drivers/ide/ide-probe.o.before
    9169 40 44 9253 2425 drivers/ide/ide-probe.o.after

    * Remove no longer needed ide_init_port_data() call from ide_unregister().

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Add ide_ports[] table keeping pointers to all initialized ports.

    * Set ide_ports[] entry for a given port in init_irq() and clear it
    ide_remove_port_from_hwgroup().

    * Convert init_irq() to use ide_ports[] instead of ide_hwifs[] for
    grouping ports into hwgroup.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Make ide_find_port_slot() return port slot index.

    * Add ide_free_port_slot() helper.

    * Move ide_init_port_data() call and error printk() from
    ide_find_port_slot() to ide_host_alloc_all().

    * Make ide_{find,free}_port_slot() take ide_cfg_mtx mutex
    and convert them use ide_indexes bitmap to keep track of
    reserved port slots.

    * Don't set hwif->chipset in ide_host_alloc_all() as it is
    no longer necessary.

    v2:
    * Pass the correct slot index to ide_init_port_data().

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Fix ide_host_register() to fail only if all ports cannot be registered.

    While at it:

    * Use host->ports[] instead of ide_hwifs[] and remove idx[].

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Add ide_host_add() helper which does ide_host_alloc()+ide_host_register(),
    then convert ide_setup_pci_device[s](), ide_legacy_device_add() and some
    host drivers to use it.

    While at it:

    * Fix ide_setup_pci_device[s](), ide_arm.c, gayle.c, ide-4drives.c,
    macide.c, q40ide.c, cmd640.c and cs5520.c to return correct error value.

    * -ENOENT -> -ENOMEM in rapide.c, ide-h8300.c, ide-generic.c, au1xxx-ide.c
    and pmac.c

    * -ENODEV -> -ENOMEM in palm_bk3710.c, ide_platform.c and delkin_cb.c

    * -1 -> -ENOMEM in ide-pnp.c

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Add struct ide_host which keeps pointers to host's ports.

    * Add ide_host_alloc[_all]() and ide_host_remove() helpers.

    * Pass 'struct ide_host *host' instead of 'u8 *idx' to
    ide_device_add[_all]() and rename it to ide_host_register[_all]().

    * Convert host drivers and core code to use struct ide_host.

    * Remove no longer needed ide_find_port().

    * Make ide_find_port_slot() static.

    * Unexport ide_unregister().

    v2:
    * Add missing 'struct ide_host *host' to macide.c.

    v3:
    * Fix build problem in pmac.c (s/ide_alloc_host/ide_host_alloc/)
    (Noticed by Stephen Rothwell).

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Add struct ide_tp_ops for transport methods.

    * Add 'const struct ide_tp_ops *tp_ops' to struct ide_port_info
    and ide_hwif_t.

    * Set the default hwif->tp_ops in ide_init_port_data().

    * Set host driver specific hwif->tp_ops in ide_init_port().

    * Export ide_exec_command(), ide_read_status(), ide_read_altstatus(),
    ide_read_sff_dma_status(), ide_set_irq(), ide_tf_{load,read}()
    and ata_{in,out}put_data().

    * Convert host drivers and core code to use struct ide_tp_ops.

    * Remove no longer needed default_hwif_transport().

    * Cleanup ide_hwif_t from methods that are now in struct ide_tp_ops.

    While at it:

    * Use struct ide_port_info in falconide.c and q40ide.c.

    * Rename ata_{in,out}put_data() to ide_{in,out}put_data().

    v2:

    * Fix missing convertion in ns87415.c.

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Add 'config' field to hw_regs_t and use it to set hwif->config_data in
    ide_init_port_hw(), then convert ide_legacy_init_one() to use hw->config.

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Don't skip probing IDE port if the corresponding ide_hwifs[] slot
    is already occupied.

    * Remove duplicate idx[i] assignment.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Reserve memory resources for all IDE ports at once by moving
    request_mem_region() out of 'for ()' loop and always defining
    GAYLE_IDEREG_SIZE to 0x2000.

    * Keep memory resources even if no free IDE slots can be found
    (this driver is unloadable currently).

    Cc: Geert Uytterhoeven
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Filter out "default" transfer mode values (0x00 - default PIO mode,
    0x01 - default PIO mode w/ IORDY disabled) in write handler for obsoleted
    /proc/ide/hd?/settings:current_speed setting.

    Allowing "default" transfer mode values is a dangerous thing to do as
    we don't support programming controller to the "default" transfer mode
    and devices often use different values for the default and maximum PIO
    mode (i.e. PIO2 default and PIO4 maximum) so the controller will stay
    programmed for higher PIO mode while device will use the lower PIO mode.

    There is no functionality loss as by using special IOCTLs device can
    still be programmed to "default" transfer modes (it is only useful for
    debugging/testing purposes anyway).

    * Remove no longer needed IDE_HFLAG_ABUSE_SET_DMA_MODE host flag, it was
    previously used by few host drivers to program the controller to PIO0
    timings for "default" transfer mode == 0x01 (although some host drivers
    would program invalid PIO timings instead).

    * Cleanup ide_set_xfer_rate() and add BUG_ON().

    Suggested-by: Sergei Shtylyov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Filter out invalid transfer mode values (0x02-0x07) in write handler
    for obsoleted /proc/ide/hd?/settings:current_speed setting.

    While at it:

    * Use XFER_UDMA_6 define.

    Suggested-by: Sergei Shtylyov
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Lets remove dead Virtual DMA support for now so it doesn't clutter
    core IDE code (it can be bring back when there is a need for it):

    * Remove IDE_HFLAG_VDMA host flag.

    * Remove ide_drive_t.vdma flag.

    * cs5520.c: remove stale FIXMEs, cs5520_dma_host_set() and cs5520_dma_ops
    (also there is no longer a need to set IDE_HFLAG_NO_ATAPI_DMA).

    There should be no functional changes caused by this patch.

    Cc: TAKADA Yoshihito
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Alan Cox has noticed some time ago that hpt34x is broken
    (http://lkml.org/lkml/2007/7/3/257):

    "No the old driver doesn't even do that. It starts up. It spuriously
    adjusts some non writable PCI BAR registers, prints a message about
    resources being in use already then exits."

    Reported-by: Alan Cox
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Cc: Ivan Kokshaysky
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Remove no longer needed ->INB, ->OUTB and ->OUTBSYNC methods.

    Then:

    * Remove no longer used default_hwif_[mm]iops() and ide_[mm_]outbsync().

    * Cleanup SuperIO handling in ns87415.c.

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Add ide_read_bcount_and_ireason() helper and use it instead of ->INB
    in {cdrom_newpc,ide_pc}_intr().

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Add ide_read_ireason() helper and use instead of ->INB for reading
    ATAPI Interrupt Reason register.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Add ide_read_device() helper and convert do_probe() to use it
    instead of ->INB.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Add IDE_TFLAG_IN_FEATURE taskfile flag for reading Feature
    register and handle it in ->tf_read.

    * Convert ide_read_error() to use ->tf_read instead of ->INB,
    then uninline and export it.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Convert SELECT_DRIVE() to use ->tf_load instead of ->OUTB.

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Convert actual_try_to_identify() to use ->tf_load instead of ->OUTB.

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Convert ide_config_drive_speed() to use ->tf_load instead of ->OUTB.

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Write ATA Feature register before ATA Sector Count register as
    a preparation to use ->tf_load in ide_config_drive_speed().

    This change shouldn't affect anything (just an usual paranoia).

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • Add ->set_irq method for setting nIEN bit of ATA Device Control
    register and use it instead of ide_set_irq().

    While at it:

    * Use ->set_irq in init_irq() and do_reset1().

    * Don't use HWIF() macro in ide_check_pm_state().

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Remove ide_read_altstatus() inline helper.

    * Add ->read_altstatus method for reading ATA Alternate Status
    register and use it instead of ->INB.

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz
     
  • * Remove ide_read_status() inline helper.

    * Add ->read_status method for reading ATA Status register
    and use it instead of ->INB.

    While at it:

    * Don't use HWGROUP() macro.

    There should be no functional changes caused by this patch.

    Signed-off-by: Bartlomiej Zolnierkiewicz

    Bartlomiej Zolnierkiewicz