1. 09 10月, 2008 1 次提交
  2. 14 9月, 2008 1 次提交
    • T
      [libata] LBA28/LBA48 off-by-one bug in ata.h · 97b697a1
      Taisuke Yamada 提交于
      I recently bought 3 HGST P7K500-series 500GB SATA drives and
      had trouble accessing the block right on the LBA28-LBA48 border.
      Here's how it fails (same for all 3 drives):
      
        # dd if=/dev/sdc bs=512 count=1 skip=268435455 > /dev/null
        dd: reading `/dev/sdc': Input/output error
        0+0 records in
        0+0 records out
        0 bytes (0 B) copied, 0.288033 seconds, 0.0 kB/s
        # dmesg
        ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
        ata1.00: BMDMA stat 0x25
        ata1.00: cmd c8/00:08:f8:ff:ff/00:00:00:00:00/ef tag 0 dma 4096 in
        res 51/04:08:f8:ff:ff/00:00:00:00:00/ef Emask 0x1 (device error)
        ata1.00: status: { DRDY ERR }
        ata1.00: error: { ABRT }
        ata1.00: configured for UDMA/33
        ata1: EH complete
        ...
      
      After some investigations, it turned out this seems to be caused
      by misinterpretation of the ATA specification on LBA28 access.
      Following part is the code in question:
      
        === include/linux/ata.h ===
        static inline int lba_28_ok(u64 block, u32 n_block)
        {
          /* check the ending block number */
          return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256);
        }
      
      HGST drive (sometimes) fails with LBA28 access of {block = 0xfffffff,
      n_block = 1}, and this behavior seems to be comformant. Other drives,
      including other HGST drives are not that strict, through.
      
      >From the ATA specification:
      (http://www.t13.org/Documents/UploadedDocuments/project/d1410r3b-ATA-ATAPI-6.pdf)
      
        8.15.29  Word (61:60): Total number of user addressable sectors
        This field contains a value that is one greater than the total number
        of user addressable sectors (see 6.2). The maximum value that shall
        be placed in this field is 0FFFFFFFh.
      
      So the driver shouldn't use the value of 0xfffffff for LBA28 request
      as this exceeds maximum user addressable sector. The logical maximum
      value for LBA28 is 0xffffffe.
      
      The obvious fix is to cut "- 1" part, and the patch attached just do
      that. I've been using the patched kernel for about a month now, and
      the same fix is also floating on the net for some time. So I believe
      this fix works reliably.
      
      Just FYI, many Windows/Intel platform users also seems to be struck
      by this, and HGST has issued a note pointing to Intel ICH8/9 driver.
      
        "28-bit LBA command is being used to access LBAs 29-bits in length"
      http://www.hitachigst.com/hddt/knowtree.nsf/cffe836ed7c12018862565b000530c74/b531b8bce8745fb78825740f00580e23
      
      Also, *BSDs seems to have similar fix included sometime around ~2004,
      through I have not checked out exact portion of the code.
      Signed-off-by: NTaisuke Yamada <tai@rakugaki.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      97b697a1
  3. 19 8月, 2008 3 次提交
  4. 24 2月, 2008 1 次提交
    • T
      libata: automatically use DMADIR if drive/bridge requires it · 91163006
      Tejun Heo 提交于
      Back in 2.6.17-rc2, a libata module parameter was added for atapi_dmadir.
      
      That's nice, but most SATA devices which need it will tell us about it
      in their IDENTIFY PACKET response, as bit-15 of word-62 of the
      returned data (as per ATA7, ATA8 specifications).
      
      So for those which specify it, we should automatically use the DMADIR bit.
      Otherwise, disc writing will fail by default on many SATA-ATAPI drives.
      
      This patch adds ATA_DFLAG_DMADIR and make ata_dev_configure() set it
      if atapi_dmadir is set or identify data indicates DMADIR is necessary.
      atapi_xlat() is converted to check ATA_DFLAG_DMADIR before setting
      DMADIR.
      
      Original patch is from Mark Lord.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Mark Lord <mlord@pobox.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      91163006
  5. 23 1月, 2008 5 次提交
    • A
      libata annotations and fixes · 4ca4e439
      Al Viro 提交于
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4ca4e439
    • T
      libata: rename ATA_PROT_ATAPI_* to ATAPI_PROT_* · 0dc36888
      Tejun Heo 提交于
      ATA_PROT_ATAPI_* are ugly and naming schemes between ATA_PROT_* and
      ATA_PROT_ATAPI_* are inconsistent causing confusion.  Rename them to
      ATAPI_PROT_* and make them consistent with ATA counterpart.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      0dc36888
    • T
      libata: add ATA_CBL_PATA_IGN · c88f90c3
      Tejun Heo 提交于
      ATA_CBL_PATA_UNK indicates that the cable type can't be determined
      from the host side and might be either 80c or 40c.  libata applies
      drive or other generic limit in this case.  However, there are
      controllers where both host and drive side detections are
      misimplemented and the driver has to rely solely on private method -
      peeking BIOS or ACPI configuration or using some other private
      mechanism.
      
      This patch adds ATA_CBL_PATA_IGN which tells libata to ignore the
      cable type completely and just let the LLD determine the transfer mode
      via host transfer mode masks and ->mode_filter().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      c88f90c3
    • T
      libata: implement protocol tests · 405e66b3
      Tejun Heo 提交于
      Implement protocol tests - ata_is_atapi(), ata_is_nodata(),
      ata_is_pio(), ata_is_dma(), ata_is_ncq() and ata_is_data() and use
      them to replace is_atapi_taskfile() and hard coded protocol tests.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      405e66b3
    • A
      libata: Disable ATA8-ACS proposed Trusted Computing features by default · ae8d4ee7
      Alan Cox 提交于
      Historically word 48 in the identify data was used to mean 32bit I/O
      was supported for VLB IDE etc. ATA8 reassigns this word to the Trusted
      Computing Group, where it is used for TCG features. This means that
      an ATA8 TCG drive is going to trigger 32bit I/O on some systems which
      will be funny.
      
      Anyway we need to sort this out ready for ATA8 so:
      - Reorder the ata.h header a bit so the ata_version function occurs early
        in it
      - Make dword_io check the ATA version
      - Add an ATA8 version checking TCG presence test
      
      While we are at it the current drafts have a flaw where it may not be
      possible to disable TCG features at boot (and opt out of the trusted
      model) as TCG intends because it relies on presence of a different
      optional feature (DCS). Handle this in software by refusing the TCG
      commands if libata.allow_tpm is not set. (We must make it possible
      as some environments such as proprietary VDR devices will doubtless
      want to use it to lock up content)
      
      Finally as with CPRM print a warning so that the user knows they may
      not be able to full access and use the device.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      ae8d4ee7
  6. 16 1月, 2008 1 次提交
  7. 18 12月, 2007 1 次提交
  8. 06 11月, 2007 1 次提交
    • A
      libata: handle broken cable reporting · 6bbfd53d
      Alan Cox 提交于
      One or two ancient drives predated the cable spec and didn't sent the
      valid bits for the field. I had hoped to leave this out of libata as a
      piece of historical annoyance but a recent CD drive shows the same bug so
      we have to import support for it.
      
      Same concept as Bartlomiej's changes old IDE except that as we have
      centralised blacklists we can avoid keeping another private table of stuff
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6bbfd53d
  9. 05 11月, 2007 1 次提交
  10. 03 11月, 2007 1 次提交
    • T
      libata: increase 128 KB / cmd limit for ATAPI tape drives · f8d8e579
      Tony Battersby 提交于
      Commands sent to ATAPI tape drives via the SCSI generic (sg) driver are
      limited in the amount of data that they can transfer by the max_sectors
      value.  The max_sectors value is currently calculated according to the
      command set for disk drives, which doesn't apply to tape drives.  The
      default max_sectors value of 256 limits ATAPI tape drive commands to
      128 KB.  This patch against 2.6.24-rc1 increases the max_sectors value
      for tape drives to 65535, which permits tape drive commands to transfer
      just under 32 MB.
      
      Tested with a SuperMicro PDSME motherboard, AHCI, and a Sony SDX-570V
      SATA tape drive.
      
      Note that some of the chipset drivers also set their own max_sectors
      value, which may override the value set in libata-core.  I don't have
      any of these chipsets to test, so I didn't go messing with them.  Also,
      ATAPI devices other than tape drives may benefit from similar changes,
      but I have only tape drives and disk drives to test.
      Signed-off-by: NTony Battersby <tonyb@cybernetics.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f8d8e579
  11. 29 10月, 2007 2 次提交
    • K
      [libata] Link power management infrastructure · ca77329f
      Kristen Carlson Accardi 提交于
      Device Initiated Power Management, which is defined
      in SATA 2.5 can be enabled for disks which support it.
      This patch enables DIPM when the user sets the link
      power management policy to "min_power".
      
      Additionally, libata drivers can define a function
      (enable_pm) that will perform hardware specific actions to
      enable whatever power management policy the user set up
      for Host Initiated Power management (HIPM).
      This power management policy will be activated after all
      disks have been enumerated and intialized.  Drivers should
      also define disable_pm, which will turn off link power
      management, but not change link power management policy.
      
      Documentation/scsi/link_power_management_policy.txt has additional
      information.
      Signed-off-by: NKristen Carlson Accardi <kristen.c.accardi@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      ca77329f
    • T
      libata: track SLEEP state and issue SRST to wake it up · 054a5fba
      Tejun Heo 提交于
      ATA devices in SLEEP mode don't respond to any commands.  SRST is
      necessary to wake it up.  Till now, when a command is issued to a
      device in SLEEP mode, the command times out, which makes EH reset the
      device and retry the command after that, causing a long delay.
      
      This patch makes libata track SLEEP state and issue SRST automatically
      if a command is about to be issued to a device in SLEEP.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Bruce Allen <ballen@gravity.phys.uwm.edu>
      Cc: Andrew Paprocki <andrew@ishiboo.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      054a5fba
  12. 24 10月, 2007 1 次提交
  13. 13 10月, 2007 5 次提交
    • R
      libata: add human-readable error value decoding · 1333e194
      Robert Hancock 提交于
      This adds human-readable decoding of the ATA status and error registers
      (similar to what drivers/ide does) as well as the SATA Serror register
      to libata error handling output.  This prevents the need to pore
      through standards documents to figure out the meaning of the bits
      in these registers when looking at error reports.  Some bits that
      drivers/ide decoded are not decoded here, since the bits are either
      command-dependent or obsolete, and properly parsing them would add
      too much complexity.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      
      [edited slightly to make output a bit more symmetric]
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1333e194
    • T
      libata: misc updates for AN · 854c73a2
      Tejun Heo 提交于
      Update AN support in preparation of PMP support.
      
      * s/ata_id_has_AN/ata_id_has_atapi_AN/
      * add AN enabled reporting during configuration
      * add err_mask to AN configuration failure reporting
      * update LOCKING comment for ata_scsi_media_change_notify()
      * check whether ATA dev is attached to SCSI dev ata_scsi_media_change_notify()
      * set ATA_FLAG_AN in ahci and sata_sil24
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      854c73a2
    • A
      libata: Strict checking for identify reporting · c7293870
      Alan Cox 提交于
      The ATA specifications require checks on certain flags before assuming
      the validity of other data. Go through the methods and correct those
      needing extra checks. Also note limits on ata_id_major_version with
      respect to ATA-1 and ATA-2. Correct the 32bit PIO check.
      
      Wants to sit in -mm for a bit in case of a screwup on my part that I
      didn't hit on the test drives and also in case someone, somewhere has
      a drive that gets it wrong.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      c7293870
    • K
      [libata] check for SATA async notify support · 9f45cbd3
      Kristen Carlson Accardi 提交于
      Check to see if an ATAPI device supports Asynchronous Notification.
      If so, enable it, if the host controller supports AN.
      Signed-off-by: NKristen Carlson Accardi <kristen.c.accardi@intel.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9f45cbd3
    • A
      libata: Correct IORDY handling · 0bc2a79a
      Alan Cox 提交于
      Debugging a report of a problem with an ancient solid state disk showed
      up some problems in the IORDY handling
      
      1.	We check the wrong bit to see if the device has IORDY
      2.	Even then some ancient creaking piles of crap don't support
      	SETXFER at all.
      
      The cases it fixes are obscure and the risk of side effects is slight
      but possible. This also moves us slightly closer to supporting original
      MFM/RLL disks with libata.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      0bc2a79a
  14. 31 8月, 2007 1 次提交
  15. 20 7月, 2007 1 次提交
  16. 11 7月, 2007 1 次提交
  17. 10 7月, 2007 1 次提交
  18. 10 6月, 2007 2 次提交
  19. 29 4月, 2007 3 次提交
    • M
      libata: Handle drives that require a spin-up command before first access · 169439c2
      Mark Lord 提交于
      (S)ATA drives can be configured for "power-up in standby",
      a mode whereby a specific "spin up now!" command is required
      before the first media access.
      
      Currently, a drive with this feature enabled can not be used at all
      with libata, and once in this mode, the drive becomes a doorstop.
      
      The older drivers/ide subsystem at least enumerates the drive,
      so that it can be woken up after the fact from a userspace HDIO_*
      command, but not libata.
      
      This patch adds support to libata for the "power-up in standby"
      mode where a "spin up now!" command (SET_FEATURES) is needed.
      With this, libata will recognize such drives, spin them up,
      and then re-IDENTIFY them if necessary to get a full/complete
      set of drive features data.
      
      Drives in this state are determined by looking for
      special values in id[2], as documented in the current ATA specs.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      169439c2
    • A
      libata: HPA support · 1e999736
      Alan Cox 提交于
      Signed-off-by: NAlan Cox <alan@redhat.com>
      
      Add support for ignoring the BIOS HPA result (off by default) and setting
      the disk to the full available size unless already frozen.
      
      Tested with various platforms/disks and confirmed to work with the
      Macintosh (which broke earlier) and ata_piix (breakage due to the LBA48
      readback that Tejun fixed).
      
      For normal users this brings us, I believe, to feature parity with old IDE
      (and of course more featured in some areas too).
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1e999736
    • M
      libata: add support for READ/WRITE LONG · 5a5dbd18
      Mark Lord 提交于
      The READ/WRITE LONG commands are theoretically obsolete,
      but the majority of drives in existance still implement them.
      
      The WRITE_LONG and WRITE_LONG_ONCE commands are of particular
      interest for fault injection testing -- eg. creating "media errors"
      at specific locations on a disk.
      
      The fussy bit is that these commands require a non-standard
      sector size, usually 520 bytes instead of 512.
      
      This patch adds support to libata for READ/WRITE LONG commands
      issued via SG_IO/ATA_16.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      5a5dbd18
  20. 04 4月, 2007 1 次提交
  21. 23 2月, 2007 1 次提交
  22. 16 2月, 2007 1 次提交
  23. 10 2月, 2007 2 次提交
  24. 02 12月, 2006 1 次提交
  25. 31 8月, 2006 1 次提交