1. 11 7月, 2007 1 次提交
    • T
      libata: simplify PCI legacy SFF host handling · d583bc18
      Tejun Heo 提交于
      With PCI resource fix up for legacy hosts.  We can use the same code
      path to allocate IO resources and initialize host for both legacy and
      native SFF hosts.  Only IRQ requesting needs to be different.
      
      Rename ata_pci_*_native_host() to ata_pci_*_sff_host(), kill all
      legacy specific functions and use the renamed functions instead.  This
      simplifies code a lot.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d583bc18
  2. 03 7月, 2007 1 次提交
    • T
      libata: fix assigned IRQ reporting · 4031826b
      Tejun Heo 提交于
      host->irq and host->irq2 should be set before ata_host_register() for
      IRQ reporting to work.  Move up host->irq assignment in
      ata_host_activate() and add it to ata_pci_init_one() native path and
      pata_cs5520.
      
      The port info printing in ata_host_register() doesn't fit all the
      different controllers.  It should probably be moved out to LLDs with
      some helpers in the future.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4031826b
  3. 10 6月, 2007 1 次提交
    • A
      libata-core/sff: Fix multiple assumptions about DMA · d92e74d3
      Alan Cox 提交于
      The ata IRQ ack functions are only used when debugging. Unfortunately
      almost every controller that calls them can cause crashes in some
      configurations as there are missing checks for bmdma presence.
      
      In addition ata_port_start insists of installing DMA buffers and pad
      buffers for controllers regardless. The SFF controllers actually need to
      make that decision dynamically at controller setup time and all need the
      same helper - so we add ata_sff_port_start. Future patches will switch
      the SFF drivers to use this.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d92e74d3
  4. 12 5月, 2007 1 次提交
    • T
      libata: clean up SFF init mess · 1626aeb8
      Tejun Heo 提交于
      The intention of using port_mask in SFF init helpers was to eventually
      support exoctic configurations such as combination of legacy and
      native port on the same controller.  This never became actually
      necessary and the related code always has been subtly broken one way
      or the other.  Now that new init model is in place, there is no reason
      to make common helpers capable of handling all corner cases.  Exotic
      cases can simply dealt within LLDs as necessary.
      
      This patch removes port_mask handling in SFF init helpers.  SFF init
      helpers don't take n_ports argument and interpret it into port_mask
      anymore.  All information is carried via port_info.  n_ports argument
      is dropped and always two ports are allocated.  LLD can tell SFF to
      skip certain port by marking it dummy.  Note that SFF code has been
      treating unuvailable ports this way for a long time until recent
      breakage fix from Linus and is consistent with how other drivers
      handle with unavailable ports.
      
      This fixes 1-port legacy host handling still broken after the recent
      native mode fix and simplifies SFF init logic.  The following changes
      are made...
      
      * ata_pci_init_native_host() and ata_init_legacy_host() both now try
        to initialized whatever they can and mark failed ports dummy.  They
        return 0 if any port is successfully initialized.
      
      * ata_pci_prepare_native_host() and ata_pci_init_one() now doesn't
        take n_ports argument.  All info should be specified via port_info
        array.  Always two ports are allocated.
      
      * ata_pci_init_bmdma() exported to be used by LLDs in exotic cases.
      
      * port_info handling in all LLDs are standardized - all port_info
        arrays are const stack variable named ppi.  Unless the second port
        is different from the first, its port_info is specified as NULL
        (tells libata that it's identical to the last non-NULL port_info).
      
      * pata_hpt37x/hpt3x2n: don't modify static variable directly.  Make an
        on-stack copy instead as ata_piix does.
      
      * pata_uli: It has 4 ports instead of 2.  Don't use
        ata_pci_prepare_native_host().  Allocate the host explicitly and use
        init helpers.  It's simple enough.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1626aeb8
  5. 01 5月, 2007 1 次提交
    • L
      libata: honour host controllers that want just one host · dc87c398
      Linus Torvalds 提交于
      The Marvell IDE interface on my machine would hit a BUG_ON() in
      lib/iomem.c because it was calling ata_pci_init_one() specifying just a
      single port on the host, but that would actually end up trying to
      initialize two ports, the second one with bogus information.
      
      This fixes "ata_pci_init_one()" so that it actually passes down the
      n_ports variable that it got from the low-level driver to the host
      allocation routine ("ata_host_alloc_pinfo()"), which results in the ATA
      layer actually having the correct port number information.
      
      And in order to make it all work, I also needed to fix a few places that
      had incorrectly hard-coded the fact that a host always had exactly two
      ports (both ata_pci_init_bmdma() and ata_request_legacy_irqs() would
      just always iterate over both ports).
      Acked-by: NJeff Garzik <jeff@garzik.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dc87c398
  6. 29 4月, 2007 7 次提交
    • T
      libata: kill probe_ent and related helpers · 6bfff31e
      Tejun Heo 提交于
      All drivers are converted to new init model.  Kill probe_ent,
      ata_device_add() and ata_pci_init_native_mode().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6bfff31e
    • T
      libata: add init helpers including ata_pci_prepare_native_host() · 21b0ad4f
      Tejun Heo 提交于
      These will be used to convert LLDs to new init model.
      
      * Add irq_handler field to port_info.  In new init model, requesting
        IRQ is LLD's responsibility and libata doesn't need to know about
        irq_handler.  Most LLDs can simply register their irq_handler but
        some need different irq_handler depending on specific chip.  The
        added port_info->irq_handler field can be used by LLDs to select
        the matching IRQ handler in such cases.
      
      * Add ata_dummy_port_info.
      
      * Implement ata_pci_prepare_native_host(), a helper to alloc ATA host,
        acquire all resources and init the host in one go.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      21b0ad4f
    • T
      libata: convert native PCI host handling to new init model · d491b27b
      Tejun Heo 提交于
      Convert native PCI host handling to alloc-init-register model.  New
      function ata_pci_init_native_host() follows the new init model and
      replaces ata_pci_init_native_mode().  As there are remaining LLD
      users, the old function isn't removed yet.
      
      ata_pci_init_one() is reimplemented using the new function and now
      fully converted to new init model.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d491b27b
    • T
      libata: convert legacy PCI host handling to new init model · 0f834de3
      Tejun Heo 提交于
      Convert legacy PCI host handling to alloc-init-register model.
      ata_init_legacy_host(), ata_request_legacy_irqs() and
      ata_pci_init_bmdma() are separated out and follow the new init model.
      
      The two legacy handling functions use separate ata_legacy_devres
      instead of generic devm_* resources.  This reduces devres overhead for
      legacy hosts which was a bit high because it didn't use PCI/iomap
      merged resoruces.
      
      ata_pci_init_one() is rewritten in terms of the aboved functions but
      native mode handling is still using the old method.  Conversion will
      be completed when native mode handling is updated.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      0f834de3
    • T
      libata: fix native mode disabled port handling · 55a6adee
      Tejun Heo 提交于
      Disabled port handling in ata_pci_init_native_mode() is slightly
      broken in that it may end up using the wrong port_info.  This patch
      updates it such that disables ports are made dummy as done in the
      legacy and other cases.
      
      While at it, fix indentation in ata_resources_present().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      55a6adee
    • J
      libata/IDE: remove combined mode quirk · 8cdfb29c
      Jeff Garzik 提交于
      Both old-IDE and libata should be able handle all controllers and
      devices found using normal resource reservation methods.
      
      This eliminates the awful, low-performing split-driver configuration
      where old-IDE drove the PATA portion of a PCI device, in PIO-only mode,
      and libata drove the SATA portion of the /same/ PCI device, in DMA mode.
      Typically vendors would ship SATA hard drive / PATA optical
      configuration, which would lend itself to slow (PIO-only) CD-ROM
      performance.
      
      For Intel users running in combined mode, it is now wholly dependent on
      your driver choice (potentially link order, if you compile both drivers
      in) whether old-IDE or libata will drive your hardware.
      
      In either case, you will get full performance from both SATA and PATA
      ports now, without having to pass a kernel command line parameter.
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      8cdfb29c
    • A
      libata: Change prototype of mode_filter to remove ata_port* · a76b62ca
      Alan Cox 提交于
      With Tejun having added adev->ap some time ago we can get rid of the
      almost unused port being passed to mode filters. And while we are
      doing filters, lets turn on the !IORDY filter as well.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      
      With some hand massaging from
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a76b62ca
  7. 26 2月, 2007 1 次提交
  8. 21 2月, 2007 1 次提交
    • T
      libata: s/ap->id/ap->print_id/g · 44877b4e
      Tejun Heo 提交于
      ata_port has two different id fields - id and port_no.  id is
      system-wide 1-based unique id for the port while port_no is 0-based
      host-wide port number.  The former is primarily used to identify the
      ATA port to the user in printk messages while the latter is used in
      various places in libata core and LLDs to index the port inside the
      host.
      
      The two fields feel quite similar and sometimes ap->id is used in
      place of ap->port_no, which is very difficult to spot.  This patch
      renames ap->id to ap->print_id to reduce the possibility of such bugs.
      
      Some printk messages are adjusted such that id string (ata%u[.%u])
      isn't printed twice and/or to use ata_*_printk() instead of hardcoded
      id format.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      44877b4e
  9. 10 2月, 2007 5 次提交
  10. 27 1月, 2007 1 次提交
    • D
      Fix Maple PATA IRQ assignment. · 8cdf92a9
      David Woodhouse 提交于
      On the Maple board, the AMD8111 IDE is in legacy mode... except that it
      appears on IRQ 20 instead of IRQ 15. For drivers/ide this was handled by
      the architecture's "pci_get_legacy_ide_irq()" function, but in libata we
      just hard-code the numbers 14 and 15.
      
      This patch provides asm-powerpc/libata-portmap.h which maps the IRQ as
      appropriate, having added a pci_dev argument to the
      ATA_{PRIM,SECOND}ARY_IRQ macros.
      
      There's probably a better way to do this -- especially if we observe
      that the _only_ case in which this seemingly-generic
      "pci_get_legacy_ide_irq()" function returns anything other than 14 and
      15 for primary and secondary respectively is the case of the AMD8111 on
      the Maple board -- couldn't we handle that with a special case in the
      pata_amd driver, or perhaps with a PCI quirk for Maple to switch it into
      native mode during early boot and assign resources properly?
      Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      8cdf92a9
  11. 26 1月, 2007 2 次提交
  12. 03 1月, 2007 1 次提交
    • A
      [PATCH] libata: fix combined mode · dc3c3377
      Alan 提交于
      This is a slight variant on the patch I posted December 16th to fix
      libata combined mode handling. The only real change is that we now
      correctly also reserve BAR1,2,4. That is basically a neatness issue.
      
      Jeff was unhappy about two things
      
      1. That it didn't work in the case of one channel native one channel
      legacy.
      
      This is a silly complaint because the SFF layer in libata doesn't handle
      this case yet anyway.
      
      2. The case where combined mode is in use and IDE=n.
      
      In this case the libata quirk code reserves the resources in question
      correctly already.
      
      Once the combined mode stuff is redone properly (2.6.21) then the entire
      mess turns into a single pci_request_regions() for all cases and all the
      ugly resource hackery goes away.
      
      I'm sending this now rather than after running full test suites so that
      it can get the maximal testing in a short time. I'll be running tests on
      this after lunch.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Acked-by: NAlessandro Suardi <alessandro.suardi@gmail.com>
      Acked-by: NTheodore Tso <tytso@mit.edu>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      dc3c3377
  13. 03 12月, 2006 3 次提交
    • T
      [PATCH] libata: make sure IRQ is cleared after ata_bmdma_freeze() · 0f0a3ad3
      Tejun Heo 提交于
      Now that BMDMA status is recorded in irq handler.  ata_bmdma_freeze()
      is free to manipulate host status.  Under certain circumstances, some
      controllers (ICH7 in enhanced mode w/ IRQ shared) raise IRQ when CTL
      register is written to and ATA_NIEN doesn't mask it.
      
      This patch makes ata_bmdma_freeze() clear all pending IRQs after
      freezing a port.  This change makes explicit clearing in
      ata_device_add() unnecessary and thus kills it.  The removed code was
      SFF-specific and was in the wrong place.
      
      Note that ->freeze() handler is always called under ap->lock held and
      irq disabled.  Even if CTL manipulation causes stuck IRQ, it's cleared
      immediately.  This should be safe (enough) even in SMP environment.
      More correct solution is to mask the IRQ from IRQ controller but that
      would be an overkill.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      0f0a3ad3
    • T
      [PATCH] libata: move BMDMA host status recording from EH to interrupt handler · ea54763f
      Tejun Heo 提交于
      For certain errors, interrupt handler alter BMDMA host status before
      entering EH (clears active and intr).  Thus altered BMDMA host status
      value is recorded by BMDMA EH and reported to user.  Move BMDMA host
      status recording from EH to interrupt handler.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      ea54763f
    • T
      [PATCH] libata: set IRQF_SHARED for legacy PCI IDE IRQs · 8070217d
      Tejun Heo 提交于
      There are machines out there which share legacy PCI IDE IRQs w/ other
      devices.  libata SFF interrupt/HSM code is ready for shared IRQ and
      has been setting IRQF_SHARED for devices in native PCI mode.  Device
      in legacy mode is still a PCI device and thus supposedly uses
      active-low level triggered IRQ.
      
      Machines with such setup should be quite rare and w/o this flag libata
      is likely to fail loading and render the system unuseable.  Also, IDE
      driver has been setting IRQF_SHARED for devices in legacy mode for a
      looooong time.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      8070217d
  14. 02 12月, 2006 2 次提交
  15. 22 10月, 2006 1 次提交
    • A
      [PATCH] libata-sff: Allow for wacky systems · 8eb166bf
      Alan Cox 提交于
      There are some Linux supported platforms that simply cannot hit the low
      I/O addresses used by ATA legacy mode PCI mappings. These platforms have
      a window for PCI space that is fixed by the board logic and doesn't
      include the neccessary locations.
      
      Provide a config option so that such platforms faced with a controller
      that they cannot support simply error it and punt
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      8eb166bf
  16. 28 9月, 2006 2 次提交
  17. 27 9月, 2006 2 次提交
  18. 19 9月, 2006 1 次提交
    • T
      [PATCH] libata: fix non-uniform ports handling · fea63e38
      Tejun Heo 提交于
      Non-uniform ports handling got broken while updating libata to handle
      those in the same host.  Only separate irq for the non-uniform
      secondary port was implemented while all other fields (host flags,
      transfer mode...) of the secondary port simply shared those of the
      first.
      
      For ata_piix combined mode, which ATM is the only user of non-uniform
      ports, this causes the secondary port assume the wrong type.  This can
      cause PATA port to use SATA ops, which results in bogus check on PCS
      and detection failure.
      
      This patch adds ata_probe_ent->pinfo2 which points to optional
      port_info for the secondary port.  For the time being, this seems to
      be the simplest solution.  This workaround will be removed together
      with ata_probe_ent itself after init model is updated to allow more
      flexibility.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Nelson A. de Oliveira <naoliv@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      fea63e38
  19. 24 8月, 2006 2 次提交
    • J
      Rename libata-bmdma.c to libata-sff.c. · e889173c
      Jeff Garzik 提交于
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      e889173c
    • J
      libata: Grand renaming. · cca3974e
      Jeff Garzik 提交于
      The biggest change is that ata_host_set is renamed to ata_host.
      
      * ata_host_set			=> ata_host
      * ata_probe_ent->host_flags	=> ata_probe_ent->port_flags
      * ata_probe_ent->host_set_flags	=> ata_probe_ent->_host_flags
      * ata_host_stats		=> ata_port_stats
      * ata_port->host		=> ata_port->scsi_host
      * ata_port->host_set		=> ata_port->host
      * ata_port_info->host_flags	=> ata_port_info->flags
      * ata_(.*)host_set(.*)\(\)	=> ata_\1host\2()
      
      The leading underscore in ata_probe_ent->_host_flags is to avoid
      reusing ->host_flags for different purpose.  Currently, the only user
      of the field is libata-bmdma.c and probe_ent itself is scheduled to be
      removed.
      
      ata_port->host is reused for different purpose but this field is used
      inside libata core proper and of different type.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cca3974e
  20. 10 8月, 2006 3 次提交
    • J
      Move libata to drivers/ata. · c6fd2807
      Jeff Garzik 提交于
      c6fd2807
    • T
      [PATCH] libata: use dummy port for stolen legacy ports · c4b01f1d
      Tejun Heo 提交于
      Use dummy port for stolen legacy ports.  This makes ap->port_no always
      equal ap->hard_port_no.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      c4b01f1d
    • A
      [PATCH] libata: rework legacy handling to remove much of the cruft · 2ec7df04
      Alan Cox 提交于
      Kill host_set->next
      Fix simplex support
      Allow per platform setting of IDE legacy bases
      
      Some of this can be tidied further later on, in particular all the
      legacy port gunge belongs as a PCI quirk/PCI header decode to understand
      the special legacy IDE rules in the PCI spec.
      
      Longer term Jeff also wants to move the request_irq/free_irq out of core
      which will make this even cleaner.
      
      tj: folded in three followup patches - ata_piix-fix, broken-arch-fix
      and fix-new-legacy-handling, and separated per-dev xfermask into
      separate patch preceding this one.  Folded in fixes are...
      
      * ata_piix-fix: fix build failure due to host_set->next removal
      * broken-arch-fix: add missing include/asm-*/libata-portmap.h
      * fix-new-legacy-handling:
      	* In ata_pci_init_legacy_port(), probe_num was incorrectly
                incremented during initialization of the secondary port and
                probe_ent->n_ports was incorrectly fixed to 1.
      
      	* Both legacy ports ended up having the same hard_port_no.
      
      	* When printing port information, both legacy ports printed
      	  the first irq.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      2ec7df04
  21. 09 8月, 2006 1 次提交