27 Oct, 2013

1 commit


25 Aug, 2013

1 commit


16 Jul, 2013

1 commit

  • Move 'struct ata_taskfile', ata_prot_flags() and their friends from
    to . They were misplaced from the beginning, as
    should cover ATA/ATAPI and related standards only -- to which the
    aforementioned structure and function have only remote relation.

    I would have moved 'enum ata_tf_protocols' closely related to 'struct
    ata_taskfile' but it unfortunately gets used by 'drivers/ide/ide-ioctls.c'...

    Signed-off-by: Sergei Shtylyov
    Signed-off-by: Tejun Heo

    Sergei Shtylyov
     

04 Apr, 2013

1 commit

  • The function returns type of ATAPI drives so it should return integer value.
    The commit 4dce8ba94c7 (libata: Use 'bool' return value for ata_id_XXX) since
    v2.6.39 changed the type of return value from int to bool, the change would
    cause all of the ATAPI class drives to be treated as TYPE_TAPE and the
    max_sectors of the drives to be set to 65535 because of the commit
    f8d8e5799b7(libata: increase 128 KB / cmd limit for ATAPI tape drives), for the
    function would return true for all ATAPI class drives and the TYPE_TAPE is
    defined as 0x01.

    Cc: stable@vger.kernel.org
    Signed-off-by: Shan Hai
    Signed-off-by: Jeff Garzik

    Shan Hai
     

15 Jan, 2013

1 commit

  • NCQ capability was used to check availability of SATA Settings page
    from Identify Device Data Log, which contains DevSlp timing variables.
    It does not work on some HDDs and leads to error messages.

    IDENTIFY word 78 bit 5(Hardware Feature Control) can't work either
    because it is only the sufficient condition of Identify Device data
    log, not the necessary condition.

    This patch replaced ata_device->sata_settings with ->devslp_timing
    to only save DevSlp timing variables(8 bytes), instead of the whole
    SATA Settings page(512 bytes).

    Addresses https://bugzilla.kernel.org/show_bug.cgi?id=51881

    Reported-by: Borislav Petkov
    Signed-off-by: Shane Huang
    Cc: stable@vger.kernel.org
    Signed-off-by: Jeff Garzik

    Shane Huang
     

13 Sep, 2012

2 commits

  • Device Sleep is a feature as described in AHCI 1.3.1 Technical Proposal.
    This feature enables an HBA and SATA storage device to enter the DevSleep
    interface state, enabling lower power SATA-based systems.

    Aggressive Device Sleep enables the HBA to assert the DEVSLP signal as
    soon as there are no commands outstanding to the device and the port
    specific Device Sleep idle timer has expired. This enables autonomous
    entry into the DevSleep interface state without waiting for software
    in power sensitive systems.

    This patch enables Aggressive Device Sleep only if both host controller
    and device support it.

    Tested on AMD reference board together with Device Sleep supported device
    sample.

    Signed-off-by: Shane Huang
    Reviewed-by: Aaron Lu
    Signed-off-by: Jeff Garzik

    Shane Huang
     
  • Define enumeration constants for IDENTIFY DEVICE words.

    Signed-off-by: Shane Huang
    Signed-off-by: Jeff Garzik

    Shane Huang
     

29 Jun, 2012

1 commit


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