15 Mar, 2011

1 commit


14 Mar, 2011

1 commit


22 Oct, 2010

1 commit

  • This change enables my x86 machine to recognize and talk to a
    "Native 4K" SATA device.

    When I started working on this, I didn't know Matthew Wilcox had
    posted a similar patch 2 years ago:
    http://git.kernel.org/?p=linux/kernel/git/willy/ata.git;a=shortlog;h=refs/heads/ata-large-sectors

    Gwendal Grignou pointed me at the the above code and small portions of
    this patch include Matthew's work. That's why Mathew is first on the
    "Signed-off-by:". I've NOT included his use of a bitmap to determine
    512 vs Native for ATA command block size - just used a simple table.
    And bugs are almost certainly mine.

    Lastly, the patch has been tested with a native 4K 'Engineering
    Sample' drive provided by Hitachi GST.

    Signed-off-by: Matthew Wilcox
    Signed-off-by: Grant Grundler
    Reviewed-by: Gwendal Grignou
    Signed-off-by: Jeff Garzik

    Grant Grundler
     

20 May, 2010

1 commit


09 Apr, 2010

1 commit

  • Most drives from Seagate, Hitachi, and possibly other brands,
    do not allow LBA28 access to sector number 0x0fffffff (2^28 - 1).
    So instead use LBA48 for such accesses.

    This bug could bite a lot of systems, especially when the user has
    taken care to align partitions to 4KB boundaries. On misaligned systems,
    it is less likely to be encountered, since a 4KB read would end at
    0x10000000 rather than at 0x0fffffff.

    Signed-off-by: Mark Lord
    Signed-off-by: Jeff Garzik

    Mark Lord
     

02 Mar, 2010

1 commit

  • I have a Delkin Devices compact flash card that isn't being recognized using the
    SATA/PATA drivers.
    The card is recognized and works with the deprecated ATA drivers.

    The error I am seeing is:
    ata1.00: failed to IDENTIFY (device reports invalid type, err_mask=0x0)

    I tracked it down to ata_id_is_cfa() in include/linux/ata.h.
    The Delkin card has id[0] set to 0x844a and id[83] set to 0.
    This isn't what the kernel expects and is probably incorrect.

    The simplest work-around is to add a check for 0x844a to ata_id_is_cfa().

    Signed-off-by: Ben Gardner
    Signed-off-by: Jeff Garzik

    Ben Gardner
     

04 Feb, 2010

1 commit

  • The value we get from the low byte of the ATA_ID_SECTOR_SIZE word is not not
    a plain multiple, but the log of it, so fix the helper to give the correct
    answer. Without this we'll get an incorrect minimal I/O size in the block
    limits VPD page for 4k sector drives.

    Also change the return value of ata_id_logical_per_physical_sectors to u16
    for the unlikely case of very large logical sectors.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jeff Garzik

    Christoph Hellwig
     

04 Dec, 2009

2 commits


03 Dec, 2009

1 commit

  • Add support for the ATA TRIM command in libata. We translate a WRITE SAME 16
    command with the unmap bit set into an ATA TRIM command and export enough
    information in READ CAPACITY 16 and the block limits EVPD page so that the new
    SCSI layer discard support will driver this for us.

    Note that I hardcode the WRITE_SAME_16 opcode for now as the patch to introduce
    the symbolic is not in 2.6.32 yet but only in the SCSI tree - as soon as it is
    merged we can fix it up to properly use the symbolic name.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jeff Garzik

    Christoph Hellwig
     

06 Oct, 2009

2 commits


02 Sep, 2009

2 commits

  • This patch improve libata's output for error/notification messages
    to allow easier comprehension and debugging:

    When ATAPI commands issued through the SCSI layer fail, use SCSI
    functions to print the CDB in human-readable form instead of just
    dumping out the CDB in hex.

    Print out the name of the failed command (as defined by the ATA
    specification) in error handling output along with the raw register
    contents.

    When reporting status of ACPI taskfile commands executed on resume,
    also output the names of the commands being executed (or not) in
    readable form.

    Since the extra data for printing command names increases kernel
    size slightly, a config option has been added to allow disabling
    command name output (as well as some of the error register parsing)
    for those highly sensitive to kernel text size.

    Signed-off-by: Robert Hancock
    Signed-off-by: Jeff Garzik

    Robert Hancock
     
  • Hopefully results in fewer on-the-wire FIS's and no breakage. We'll see!

    Signed-off-by: Shaohua Li
    Signed-off-by: Jeff Garzik

    Shaohua Li
     

16 Jun, 2009

1 commit


16 May, 2009

1 commit

  • This patch provides new heuristics for parsing both the form factor and
    media rotation rate ATA IDENFITY words.

    The reported ATA version must be 7 or greater and the device must return
    values defined as valid in the standard. Only then are the
    characteristics reported to SCSI via the VPD B1 page.

    This seems like a reasonable compromise to me considering that we have
    been shipping several kernel releases that key off the rotation rate bit
    without any version checking whatsoever. With no complaints so far.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: Jeff Garzik

    Martin K. Petersen
     

07 Apr, 2009

1 commit


27 Mar, 2009

1 commit

  • * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (35 commits)
    [libata] Improve timeout handling
    [libata] Drain data on errors
    pata_sc1200: Activate secondary channel
    pata_artop: Serializing support
    [libata] ahci: correct enclosure LED state save
    [libata] More robust parsing for IDENTIFY DEVICE multi_count field
    sata_mv: fix LED blinking for SoC+NCQ
    sata_mv: optimize IRQ coalescing for 8-port chips
    sata_mv: implement IRQ coalescing (v2)
    sata_mv: cosmetic preparations for IRQ coalescing
    pata-rb532-cf: platform_get_irq() fix ignored failure
    pata_efar: fix *dma_mask
    pata_radisys: fix mwdma_mask to exclude mwdma0
    [libata] convert drivers to use ata.h mode mask defines
    include/linux/ata.h: add some more transfer masks
    ahci: Blacklist HP Compaq 6720s that spins off disks during ACPI power off
    [libata] sata_mv: Implement direct FIS transmission via mv_qc_issue_fis().
    [libata] Export ata_pio_queue_task() so that it can be used from sata_mv.
    [libata] sata_mv: Add a new mv_sff_check_status() function to sata_mv.
    [libata] sata_mv: Tighten up interrupt masking in mv_qc_issue()
    ...

    Linus Torvalds
     

25 Mar, 2009

2 commits


06 Mar, 2009

1 commit


03 Feb, 2009

1 commit

  • When checking for the CFA feature set support, ata_id_is_cfa() tests bit 2 in
    word 82 of the identify data instead the word 83; it also checks the ATA/PI
    version support in the word 80 (which the CompactFlash specifications have as
    reserved), this having no slightest chance to work on the modern CF cards that
    don't have 0x848A in the word 0...

    Signed-off-by: Sergei Shtylyov
    Signed-off-by: Jeff Garzik

    Sergei Shtylyov
     

11 Oct, 2008

7 commits


09 Oct, 2008

1 commit


29 Sep, 2008

1 commit


14 Sep, 2008

1 commit

  • 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 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: Taisuke Yamada
    Signed-off-by: Jeff Garzik

    Taisuke Yamada
     

19 Aug, 2008

3 commits


24 Feb, 2008

1 commit

  • 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: Tejun Heo
    Cc: Mark Lord
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

23 Jan, 2008

4 commits

  • Signed-off-by: Al Viro
    Signed-off-by: Jeff Garzik

    Al Viro
     
  • 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: Tejun Heo
    Signed-off-by: Jeff Garzik

    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: Tejun Heo
    Cc: Alan Cox
    Signed-off-by: Jeff Garzik

    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: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo