1. 22 8月, 2008 1 次提交
    • A
      libata: Fix a large collection of DMA mode mismatches · b15b3eba
      Alan Cox 提交于
      Dave Müller sent a diff for the pata_oldpiix that highlighted a problem
      where a lot of the ATA drivers assume dma_mode == 0 means "no DMA" while
      the core code uses 0xFF.
      
      This turns out to have other consequences such as code doing >= XFER_UDMA_0
      also catching 0xFF as UDMAlots. Fortunately it doesn't generally affect
      set_dma_mode, although some drivers call back into their own set mode code
      from other points.
      
      Having been through the drivers I've added helpers for using_udma/using_mwdma
      dma_enabled so that people don't open code ranges that may change (eg if UDMA8
      appears somewhere)
      
      Thanks to David for the initial bits
      [and added fix for pata_oldpiix from and signed-off-by Dave Mueller
       <dave.mueller@gmx.ch>  -jg]
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      b15b3eba
  2. 06 5月, 2008 1 次提交
    • A
      pata_atiixp: Don't disable · 05177f17
      Alan Cox 提交于
      A couple of distributions (Fedora, Ubuntu) were having weird problems with the
      ATI IXP series PATA controllers being reported as simplex.  At the heart of
      the problem is that both distros ignored the recommendations to load pata_acpi
      and ata_generic *AFTER* specific host drivers.
      
      The underlying cause however is that if you D3 and then D0 an ATI IXP it
      helpfully throws away some configuration and won't let you rewrite it.
      
      Add checks to ata_generic and pata_acpi to pin ATIIXP devices.  Possibly the
      real answer here is to quirk them and pin them, but right now we can't do that
      before they've been pcim_enable()'d by a driver.
      
      I'm indebted to David Gero for this.  His bug report not only reported the
      problem but identified the cause correctly and he had tested the right values
      to prove what was going on
      
      [If you backport this for 2.6.24 you will need to pull in the 2.6.25
      removal of the bogus WARN_ON() in pcim_enagle]
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Tested-by: NDavid Gero <davidg@havidave.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      05177f17
  3. 18 4月, 2008 5 次提交
    • T
      libata: rename SFF functions · 9363c382
      Tejun Heo 提交于
      SFF functions have confusing names.  Some have sff prefix, some have
      bmdma, some std, some pci and some none.  Unify the naming by...
      
      * SFF functions which are common to both BMDMA and non-BMDMA are
        prefixed with ata_sff_.
      
      * SFF functions which are specific to BMDMA are prefixed with
        ata_bmdma_.
      
      * SFF functions which are specific to PCI but apply to both BMDMA and
        non-BMDMA are prefixed with ata_pci_sff_.
      
      * SFF functions which are specific to PCI and BMDMA are prefixed with
        ata_pci_bmdma_.
      
      * Drop generic prefixes from LLD specific routines.  For example,
        bfin_std_dev_select -> bfin_dev_select.
      
      The following renames are noteworthy.
      
        ata_qc_issue_prot() -> ata_sff_qc_issue()
        ata_pci_default_filter() -> ata_bmdma_mode_filter()
        ata_dev_try_classify() -> ata_sff_dev_classify()
      
      This rename is in preparation of separating SFF support out of libata
      core layer.  This patch strictly renames functions and doesn't
      introduce any behavior difference.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      9363c382
    • T
      libata: stop overloading port_info->private_data · 887125e3
      Tejun Heo 提交于
      port_info->private_data is currently used for two purposes - to record
      private data about the port_info or to specify host->private_data to
      use when allocating ata_host.
      
      This overloading is confusing and counter-intuitive in that
      port_info->private_data becomes host->private_data instead of
      port->private_data.  In addition, port_info and host don't correspond
      to each other 1-to-1.  Currently, the first non-NULL
      port_info->private_data is used.
      
      This patch makes port_info->private_data just be what it is -
      private_data for the port_info where LLD can jot down extra info.
      libata no longer sets host->private_data to the first non-NULL
      port_info->private_data, @host_priv argument is added to
      ata_pci_init_one() instead.  LLDs which use ata_pci_init_one() can use
      this argument to pass in pointer to host private data.  LLDs which
      don't should use init-register model anyway and can initialize
      host->private_data directly.
      
      Adding @host_priv instead of using init-register model for LLDs which
      use ata_pci_init_one() is suggested by Alan Cox.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      887125e3
    • T
      libata: make ata_pci_init_one() not use ops->irq_handler and pi->sht · 1bd5b715
      Tejun Heo 提交于
      ata_pci_init_one() is the only function which uses ops->irq_handler
      and pi->sht.  Other initialization functions take the same information
      as arguments.  This causes confusion and duplicate unused entries in
      structures.
      
      Make ata_pci_init_one() take sht as an argument and use ata_interrupt
      implicitly.  All current users use ata_interrupt and if different irq
      handler is necessary open coding ata_pci_init_one() using
      ata_prepare_sff_host() and ata_activate_sff_host can be done under ten
      lines including error handling and driver which requires custom
      interrupt handler is likely to require custom initialization anyway.
      
      As ata_pci_init_one() was the last user of ops->irq_handler, this
      patch also kills the field.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      1bd5b715
    • T
      libata: implement and use ops inheritance · 029cfd6b
      Tejun Heo 提交于
      libata lets low level drivers build ata_port_operations table and
      register it with libata core layer.  This allows low level drivers
      high level of flexibility but also burdens them with lots of
      boilerplate entries.
      
      This becomes worse for drivers which support related similar
      controllers which differ slightly.  They share most of the operations
      except for a few.  However, the driver still needs to list all
      operations for each variant.  This results in large number of
      duplicate entries, which is not only inefficient but also error-prone
      as it becomes very difficult to tell what the actual differences are.
      
      This duplicate boilerplates all over the low level drivers also make
      updating the core layer exteremely difficult and error-prone.  When
      compounded with multi-branched development model, it ends up
      accumulating inconsistencies over time.  Some of those inconsistencies
      cause immediate problems and fixed.  Others just remain there dormant
      making maintenance increasingly difficult.
      
      To rectify the problem, this patch implements ata_port_operations
      inheritance.  To allow LLDs to easily re-use their own ops tables
      overriding only specific methods, this patch implements poor man's
      class inheritance.  An ops table has ->inherits field which can be set
      to any ops table as long as it doesn't create a loop.  When the host
      is started, the inheritance chain is followed and any operation which
      isn't specified is taken from the nearest ancestor which has it
      specified.  This operation is called finalization and done only once
      per an ops table and the LLD doesn't have to do anything special about
      it other than making the ops table non-const such that libata can
      update it.
      
      libata provides four base ops tables lower drivers can inherit from -
      base, sata, pmp, sff and bmdma.  To avoid overriding these ops
      accidentaly, these ops are declared const and LLDs should always
      inherit these instead of using them directly.
      
      After finalization, all the ops table are identical before and after
      the patch except for setting .irq_handler to ata_interrupt in drivers
      which didn't use to.  The .irq_handler doesn't have any actual effect
      and the field will soon be removed by later patch.
      
      * sata_sx4 is still using old style EH and currently doesn't take
        advantage of ops inheritance.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      029cfd6b
    • T
      libata: implement and use SHT initializers · 68d1d07b
      Tejun Heo 提交于
      libata lets low level drivers build scsi_host_template and register it
      to the SCSI layer.  This allows low level drivers high level of
      flexibility but also burdens them with lots of boilerplate entries.
      
      This patch implements SHT initializers which can be used to initialize
      all the boilerplate entries in a sht.  Three variants of them are
      implemented - BASE, BMDMA and NCQ - for different types of drivers.
      Note that entries can be overriden by putting individual initializers
      after the helper macro.
      
      All sht tables are identical before and after this patch.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      68d1d07b
  4. 16 2月, 2008 1 次提交
  5. 23 1月, 2008 2 次提交
  6. 29 10月, 2007 1 次提交
  7. 18 10月, 2007 1 次提交
  8. 13 10月, 2007 1 次提交
    • A
      pata_acpi: ACPI driver support · 025621f9
      Alan Cox 提交于
      	On a cable there may be
      	eighty wires or perhaps forty
      	and we learn about its type
      	In the world of ACPI
      
      	So we call the GTM
      	And we find the the timing rate
      	And we look through it to see
      	If eighty wire it must be
      
      	Timing lives in ACPI routines
      	ACPI routines, ACPI routines
      	Timing lives in ACPI routines
      	ACPI routes ACPI routines
      
      	And the drivers last you see
      	Picking up unknown pci ids
      	and the code begins to work
      
      	Timing lives in ACPI routines
      	ACPI routines, ACPI routines
      	Timing lives in ACPI routines
      	ACPI routes ACPI routines
      
      	[Full speed ahead, Mr Hacker, full speed ahead]
      	 Full speed over here sir!
      	 Checking Cable, checking cable
      	 Aye aye, 80 wire,
      	 Heaven heaven]
      
      	If we use ACPI (ACPI)
      	Every box (every box) has all we need (has all we need)
      	Cable type (cable type) and mode timing (mode timing)
      	In our ATA (in our ATA) subroutines (subroutines, ha ha)
      
      	Timing lives in ACPI routines
      	ACPI routines, ACPI routines
      	Timing lives in ACPI routines
      	ACPI routes ACPI routines
      	Timing lives in ACPI routines
      	ACPI routines, ACPI routines
      	Timing lives in ACPI routines
      	ACPI routes ACPI routines
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      025621f9