02 Jul, 2010

3 commits

  • IDE mode of MCP89 on MBP 7,1 doesn't set DMA enable bits in the BMDMA
    status register. Make the following changes to work around the problem.

    * Instead of using hard coded 1 in id->driver_data as class code
    match, use ATA_GEN_CLASS_MATCH and carry the matched id in
    host->private_data.

    * Instead of matching PCI_VENDOR_ID_CENATEK, use ATA_GEN_FORCE_DMA
    flag in id instead.

    * Add ATA_GEN_FORCE_DMA to the id entry of MBP 7,1.

    Signed-off-by: Tejun Heo
    Cc: Peer Chen
    Cc: stable@kernel.org
    Reported-by: Anders Østhus
    Reported-by: Andreas Graf
    Reported-by: Benoit Gschwind
    Reported-by: Damien Cassou
    Reported-by: tixetsal@juno.com
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • For yet unknown reason, MCP89 on MBP 7,1 doesn't work w/ ahci under
    linux but the controller doesn't require explicit mode setting and
    works fine with ata_generic. Make ahci ignore the controller on MBP
    7,1 and let ata_generic take it for now.

    Reported in bko#15923.

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

    NVIDIA is investigating why ahci mode doesn't work.

    Signed-off-by: Tejun Heo
    Cc: Peer Chen
    Cc: stable@kernel.org
    Reported-by: Anders Østhus
    Reported-by: Andreas Graf
    Reported-by: Benoit Gschwind
    Reported-by: Damien Cassou
    Reported-by: tixetsal@juno.com
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • In function ahci_store_em_buffer(), if the input (signed char*) buffer
    contains negative data, the constructed 32-bit long message data may
    be wrong.

    Signed-off-by: Harry Zhang
    Signed-off-by: Jeff Garzik

    Harry Zhang
     

11 Jun, 2010

2 commits

  • The data in the cmd_block buffers may reach the main memory after the
    writel() to the device ports. This patch introduces two calls to wmb()
    to ensure the relative ordering.

    Signed-off-by: Catalin Marinas
    Tested-by: Colin Tuckley
    Cc: Tejun Heo
    Cc: Jeff Garzik
    Signed-off-by: Jeff Garzik

    Catalin Marinas
     
  • cb->atapi.cdb is an array of 16 u8 elements. The call too memset()
    would set the first part of the sge array to zero as well. It's not
    a packed struct.

    This one has been around for five years. I found it with Smatch. I
    think the reason no one has seen it before is because we normally call
    sil24_fill_sg() and that overwrites sge with proper information?

    Signed-off-by: Dan Carpenter
    Signed-off-by: Jeff Garzik

    Dan Carpenter
     

08 Jun, 2010

3 commits

  • Commit 96d60303fd (ahci: Turn off DMA engines when there's no device)
    implemented stopping DMA engines on empty ports but it used single
    sampling of status registers to determine device presence which led to
    disabling of DMA engines on occupied ports. Do it after all EH
    actions are complete using device presence state determined by EH.
    This avoids spurious disabling of DMA engines and simplifies the code.

    Signed-off-by: Tejun Heo
    Tested-by: Marc Dionne
    Cc: Matthew Garrett
    Cc: Robert Hancock
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • The sata_sil24 driver has six 16-bit registers that are initialised with
    32-bit writes. This cause a kernel panic on ARM due to the unaligned
    accesses which result.

    This patch changes the accesses to the correct 16-bit ones.

    Signed-off-by: Colin Tuckley
    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Colin Tuckley
     
  • Add Joseph Chan's explanation of the problem and workaround to the
    VT6421 magic fix.

    Signed-off-by: Tejun Heo
    Cc: Joseph Chan
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

04 Jun, 2010

1 commit


03 Jun, 2010

5 commits

  • Implement ata_scsi_unlock_native_capacity() which will be called
    through SCSI layer when block layer notices that partitions on a
    device extend beyond the end of the device. It requests EH to unlock
    HPA, waits for completion and returns the current device capacity.

    This allows libata to unlock HPA on demand instead of having to decide
    whether to unlock upfront. Unlocking on demand is safer than
    unlocking by upfront because some BIOSes write private data to the
    area beyond HPA limit. This was suggested by Ben Hutchings.

    Signed-off-by: Tejun Heo
    Suggested-by: Ben Hutchings
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • After late HPA unlock, libata kept using the original capacity
    ignoring the new larger native capacity. Enlarging device on the fly
    doesn't cause any harm. Use the larger native capacity instead. This
    will enable on-demand HPA unlocking.

    Signed-off-by: Tejun Heo
    Cc: Ben Hutchings
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Signed-off-by: Stefan Richter
    Signed-off-by: Jeff Garzik

    Stefan Richter
     
  • On mcp55, nIEN gets stuck once set and liteon blueray rom iHOS104-08
    violates ATA specification and fails to set I on D2H Reg FIS if nIEN
    is set when the command was issued. When the other party is following
    the spec, both devices can work fine but when the two flaws are put
    together, they can't talk to each other.

    mcp55 has its own IRQ masking mechanism and there's no reason to mess
    with nIEN in the first place. Fix it by dropping nIEN diddling from
    nv_mcp55_freeze/thaw().

    This was originally reported by Cengiz. Although Cengiz hasn't
    verified the fix yet, I could reproduce this problem and verfiy the
    fix. Even if Cengiz is experiencing different or additional problems,
    this patch is needed.

    Signed-off-by: Tejun Heo
    Reported-by: Cengiz Günay
    Cc: stable@kernel.org
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • vt6421 has problems talking to recent WD drives. It causes a lot of
    transmission errors while high bandwidth transfer as reported in the
    following bugzilla entry.

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

    Joseph Chan provided the following fix. I don't have any idea what it
    does but I can verify the issue is gone with the patch applied.

    Signed-off-by: Tejun Heo
    Originally-from: Joseph Chan
    Reported-by: Jorrit Tijben
    Cc: stable@kernel.org
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

02 Jun, 2010

1 commit

  • Grant patches added an of mach table to struct device_driver. However,
    while he changed the macio device code to use that, he left the match
    table pointer in struct macio_driver and didn't update drivers to use
    the "new" one, thus breaking the probing.

    This completes the change by moving all drivers to setup the "new"
    one, removing all traces of the old one, and while at it (since it
    changes the exact same locations), I also remove two other duplicates
    from struct driver which are the name and owner fields.

    Signed-off-by: Benjamin Herrenschmidt

    Benjamin Herrenschmidt
     

26 May, 2010

8 commits

  • Add dump_id libata.force parameter. If specified, libata dumps full
    IDENTIFY data during device configuration. This is to aid debugging.

    Signed-off-by: Tejun Heo
    Cc: Larry Baker
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • There are ATAPI devices which raise AN when hit by commands issued by
    open(). This leads to infinite loop of AN -> MEDIA_CHANGE uevent ->
    udev open() to check media -> AN.

    Both ACS and SerialATA standards don't define in which case ATAPI
    devices are supposed to raise or not raise AN. They both list media
    insertion event as a possible use case for ATAPI ANs but there is no
    clear description of what constitutes such events. As such, it seems
    a bit too naive to export ANs directly to userland as MEDIA_CHANGE
    events without further verification (which should behave similarly to
    windows as it apparently is the only thing that some hardware vendors
    are testing against).

    This patch adds libata.atapi_an module parameter and disables ATAPI AN
    by default for now.

    Signed-off-by: Tejun Heo
    Cc: Kay Sievers
    Cc: Nick Bowler
    Cc: David Zeuthen
    Cc: stable@kernel.org
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Make BMDMA optional depending on new config variable CONFIG_ATA_BMDMA.
    In Kconfig, drivers are grouped into five groups - non-SFF native, SFF
    w/ custom DMA interface, SFF w/ BMDMA, PIO-only SFF, and generic
    fallback / legacy ones. Kconfig and Makefile are reorganized
    according to the groups and ordered alphabetically inside each group.

    ata_ioports.bmdma_addr and ata_port.bmdma_prd[_dma] are put into
    CONFIG_ATA_BMDMA, as are all bmdma related ops, variables and
    functions.

    This increase the binary size slightly when BMDMA is enabled but on
    both native-only and PIO-only configurations the size is slightly
    reduced. Either way, the size difference is insignificant. This
    change is more meaningful to signify the separation between SFF and
    BMDMA and as a tool to verify the separation.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Now that SFF and BMDMA are completely separate, sata_qstor and
    pata_octeon_cf which inherit from ata_sff_port_ops don't need to worry
    about BMDMA ops being called. Kill the dummy BMDMA ops.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Separate out ata_pci_bmdma_prepare_host() and ata_pci_bmdma_init_one()
    from their SFF counterparts. SFF ones no longer try to initialize
    BMDMA or set PCI master.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Separate out BMDMA irq handler from SFF irq handler. The misnamed
    host_intr() functions are renamed to ata_sff_port_intr() and
    ata_bmdma_port_intr(). Common parts are factored into
    __ata_sff_port_intr() and __ata_sff_interrupt() and used by sff and
    bmdma interrupt routines.

    All BMDMA drivers now use ata_bmdma_interrupt() or
    ata_bmdma_port_intr() while all non-BMDMA SFF ones use
    ata_sff_interrupt() or ata_sff_port_intr().

    For now, ata_pci_sff_init_one() uses ata_bmdma_interrupt() as it's
    used by both SFF and BMDMA drivers.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • ata_sff_irq_clear() is BMDMA specific. Rename it to
    ata_bmdma_irq_clear(), move it to ata_bmdma_port_ops and make
    ->sff_irq_clear() optional.

    Note: ata_bmdma_irq_clear() is actually only needed by ata_piix and
    possibly by sata_sil. This should be moved to respective low
    level drivers later.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Now that BMDMA EH ops are separated out from SFF ops, mv5_ops doesn't
    have to explicitly reset ->error_handler() and ->post_internal_cmd().
    Drop them.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

22 May, 2010

2 commits

  • Merging in current state of Linus' tree to deal with merge conflicts and
    build failures in vio.c after merge.

    Conflicts:
    drivers/i2c/busses/i2c-cpm.c
    drivers/i2c/busses/i2c-mpc.c
    drivers/net/gianfar.c

    Also fixed up one line in arch/powerpc/kernel/vio.c to use the
    correct node pointer.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • .name, .match_table and .owner are duplicated in both of_platform_driver
    and device_driver. This patch is a removes the extra copies from struct
    of_platform_driver and converts all users to the device_driver members.

    This patch is a pretty mechanical change. The usage model doesn't change
    and if any drivers have been missed, or if anything has been fixed up
    incorrectly, then it will fail with a compile time error, and the fixup
    will be trivial. This patch looks big and scary because it touches so
    many files, but it should be pretty safe.

    Signed-off-by: Grant Likely
    Acked-by: Sean MacLennan

    Grant Likely
     

21 May, 2010

2 commits

  • * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (49 commits)
    libata-sff: separate out BMDMA qc_issue
    libata-sff: prd is BMDMA specific
    libata-sff: ata_sff_[dumb_]qc_prep are BMDMA specific
    libata-sff: separate out BMDMA EH
    libata-sff: port_task is SFF specific
    libata-sff: ap->[last_]ctl are SFF specific
    libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo()
    libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init()
    libata-sff: clean up BMDMA initialization
    libata-sff: clean up inheritance in several drivers
    libata-sff: reorder SFF/BMDMA functions
    sata_inic162x: kill PORT_PRD_ADDR initialization
    libata: kill ATA_FLAG_DISABLED
    libata-sff: kill unused prototype and make ata_dev_select() static
    libata-sff: update bmdma host bus error handling
    sata_mv: remove unnecessary initialization
    sata_inic162x: inic162x is not dependent on CONFIG_ATA_SFF
    pata_sch: use ata_pci_sff_init_one()
    pata_sil680: Do our own exec_command posting
    libata: Remove excess delay in the tf_load path
    ...

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (44 commits)
    vlynq: make whole Kconfig-menu dependant on architecture
    add descriptive comment for TIF_MEMDIE task flag declaration.
    EEPROM: max6875: Header file cleanup
    EEPROM: 93cx6: Header file cleanup
    EEPROM: Header file cleanup
    agp: use NULL instead of 0 when pointer is needed
    rtc-v3020: make bitfield unsigned
    PCI: make bitfield unsigned
    jbd2: use NULL instead of 0 when pointer is needed
    cciss: fix shadows sparse warning
    doc: inode uses a mutex instead of a semaphore.
    uml: i386: Avoid redefinition of NR_syscalls
    fix "seperate" typos in comments
    cocbalt_lcdfb: correct sections
    doc: Change urls for sparse
    Powerpc: wii: Fix typo in comment
    i2o: cleanup some exit paths
    Documentation/: it's -> its where appropriate
    UML: Fix compiler warning due to missing task_struct declaration
    UML: add kernel.h include to signal.c
    ...

    Linus Torvalds
     

20 May, 2010

10 commits

  • Separate out ata_bmdma_qc_issue() from ata_sff_qc_issue() such that
    ata_sff_qc_issue() only deals with non-BMDMA SFF protocols (PIO and
    nodata) while ata_bmdma_qc_issue() deals with the BMDMA protocols and
    uses ata_sff_qc_issue() for non-DMA commands. All the users are
    updated accordingly.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • struct ata_prd and ap->prd are BMDMA specific. Add bmdma_ prefix to
    them and move them inside CONFIG_ATA_SFF.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Both qc_prep functions deal only with BMDMA PRD setup and PIO only SFF
    drivers don't need them. Rename to ata_bmdma_[dumb_]qc_prep() and
    relocate.

    All usages are renamed except for pdc_adma and sata_qstor. Those two
    drivers are not BMDMA drivers and don't need to call BMDMA qc_prep
    functions. Calls to ata_sff_qc_prep() in the two drivers are removed.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Some of error handling logic in ata_sff_error_handler() and all of
    ata_sff_post_internal_cmd() are for BMDMA. Create
    ata_bmdma_error_handler() and ata_bmdma_post_internal_cmd() and move
    BMDMA part into those.

    While at it, change DMA protocol check to ata_is_dma(), fix
    post_internal_cmd to call ap->ops->bmdma_stop instead of directly
    calling ata_bmdma_stop() and open code hardreset selection so that
    ata_std_error_handler() doesn't have to know about sff hardreset.

    As these two functions are BMDMA specific, there's no reason to check
    for bmdma_addr before calling bmdma methods if the protocol of the
    failed command is DMA. sata_mv and pata_mpc52xx now don't need to set
    .post_internal_cmd to ATA_OP_NULL and pata_icside and sata_qstor don't
    need to set it to their bmdma_stop routines.

    ata_sff_post_internal_cmd() becomes noop and is removed.

    This fixes p3 described in clean-up-BMDMA-initialization patch.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • port_task is tightly bound to the standard SFF PIO HSM implementation.
    Using it for any other purpose would be error-prone and there's no
    such user and if some drivers need such feature, it would be much
    better off using its own. Move it inside CONFIG_ATA_SFF and rename it
    to sff_pio_task.

    The only function which is exposed to the core layer is
    ata_sff_flush_pio_task() which is renamed from ata_port_flush_task()
    and now also takes care of resetting hsm_task_state to HSM_ST_IDLE,
    which is possible as it's now specific to PIO HSM.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • ap->[last_]ctl are specific to SFF controllers. Put them inside
    CONFIG_ATA_SFF and move initialization into ata_sff_port_init().

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • ->drain_fifo() is SFF specific. Rename and relocate it.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • In preparation of proper SFF/BMDMA separation, introduce
    ata_sff_init/exit() and ata_sff_port_init(). These functions
    currently don't do anything.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • When BMDMA initialization failed or BMDMA was not available for
    whatever reason, bmdma_addr was left at zero and used as an indication
    that BMDMA shouldn't be used. This leads to the following problems.

    p1. For BMDMA drivers which don't use traditional BMDMA register,
    ata_bmdma_mode_filter() incorrectly inhibits DMA modes. Those
    drivers either have to inherit from ata_sff_port_ops or clear
    ->mode_filter explicitly.

    p2. non-BMDMA drivers call into BMDMA PRD table allocation. It
    doesn't actually allocate PRD table if bmdma_addr is not
    initialized but is still confusing.

    p3. For BMDMA drivers which don't use traditional BMDMA register, some
    methods might not be invoked as expected (e.g. bmdma_stop from
    ata_sff_post_internal_cmd()).

    p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
    worrying libata core might call into one of them.

    These problems are caused by the muddy line between SFF and BMDMA and
    the assumption that all BMDMA controllers initialize bmdma_addr.

    This patch fixes p1 and p2 by removing the bmdma_addr assumption and
    moving prd allocation to BMDMA port start. Later patches will fix the
    remaining issues.

    This patch improves BMDMA initialization such that

    * When BMDMA register initialization fails, falls back to PIO instead
    of failing. ata_pci_bmdma_init() never fails now.

    * When ata_pci_bmdma_init() falls back to PIO, it clears
    ap->mwdma_mask and udma_mask instead of depending on
    ata_bmdma_mode_filter(). This makes ata_bmdma_mode_filter()
    unnecessary thus resolving p1.

    * ata_port_start() which actually is BMDMA specific is moved to
    ata_bmdma_port_start(). ata_port_start() and ata_sff_port_start()
    are killed.

    * ata_sff_port_start32() is moved and renamed to
    ata_bmdma_port_start32().

    Drivers which no longer call into PRD table allocation are...

    pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all
    drivers which inherit from ata_sff_port_ops.

    pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD
    but is a BMDMA controller and doesn't have custom port_start like
    other such controllers.

    Note that with the previous patch which makes all and only BMDMA
    drivers inherit from ata_bmdma_port_ops, this change doesn't break
    drivers which need PRD table.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • 1. pata_cmd640 is PIO only. Inherit from sff.

    2. pata_macio is BMDMA. Inherit from bmdma and drop explicit
    bmdma_mode_filter() setting.

    3. In sata_mv, unlike mv5, mv6 is BMDMA. Inherit from bmdma and
    don't clear ->post_internal_cmd().

    4. bf54x and icside are quasi-BMDMA controllers which don't use the
    standard BMDMA registers so they don't initialize bmdma_addr and
    inherit from sff to avoid the default mode_filter which disables
    DMA modes if bmdma_addr is not initialized.

    For 2 and 3, this patch makes the drivers explicitly specify
    ->mode_filter to ATA_OP_NULL while inheriting from ata_bmdma_port_ops.
    These will be removed by the next patch.

    This patch makes all and only BMDMA drivers inherit from
    ata_bmdma_port_ops to ease further SFF/BMDMA separation.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

19 May, 2010

1 commit


18 May, 2010

2 commits